Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Import Excel comments to Access database?

Status
Not open for further replies.

sandhu

Programmer
Aug 7, 2003
20
0
0
IN
Hi,

I have an excel time-sheetand, in which, for each number of hours entered in the cells, a comment has been entered.
I have imported the data in the cells, but also need to import the comments given in each cell.
Please help,how can I import the comments into an Access database.

Thanks in advance.

Regards,
Sandhu
 
Sandhu

I would extract the comments and put them into the column next to the one containing the data - then import them as usual. The macro would be something like this:

'==================================
Sub ExtractComment()

Dim RowCount As Long

'set these constants to suit your spreadsheet
'you might want to dynamically determine the number of rows instead
Const SourceCol = 1
Const TargetCol = 2
Const MaxRows As Long = 50

'ignore errors if there are no comments in a cell
On Error Resume Next

'loop through the cells in the column and extract the comment
For RowCount = 1 To MaxRows
ActiveSheet.Cells(RowCount, TargetCol) = ActiveSheet.Cells(RowCount, SourceCol).Comment.Text
Next

End Sub
'===================================

Let me know if you have problems with it.

Cheers

Iain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top