Comment to cell in Excel 2003 (Dutch version)

Flash0220

Board Regular
Joined
May 2, 2002
Messages
104
Hello,


I'm having the following (small ?) problem.

I have a collumn containing different filenames.
In each cell of that collumn the path to that filename
is stored as a comment.

I want these comments to be converted to cell values (in a different collumn).

Is there an easy way to do this using formulas or VBA ?

Thank in advance for helping. :-)




Flash
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Code:
[FONT=Fixedsys]Option Explicit[/FONT]
 
[FONT=Fixedsys]Public Sub ExtractComments()[/FONT]
 
[FONT=Fixedsys]Dim ws As Worksheet[/FONT]
[FONT=Fixedsys]Dim iLastRow As Long[/FONT]
[FONT=Fixedsys]Dim iRow As Long[/FONT]
 
[FONT=Fixedsys]Set ws = ThisWorkbook.Sheets(1)[/FONT]
[FONT=Fixedsys]iLastRow = ws.Cells(ws.Rows.Count, "[COLOR=red]B[/COLOR]").End(xlUp).Row[/FONT]
 
[FONT=Fixedsys]For iRow = 1 To iLastRow[/FONT]
[FONT=Fixedsys]  If Not ws.Cells(iRow, "[COLOR=red]B[/COLOR]").Comment Is Nothing Then[/FONT]
[FONT=Fixedsys]    ws.Cells(iRow, "[COLOR=blue]C[/COLOR]") = ws.Cells(iRow, "[COLOR=red]B[/COLOR]").Comment.Text[/FONT]
[FONT=Fixedsys]  End If[/FONT]
[FONT=Fixedsys]Next iRow[/FONT]
 
[FONT=Fixedsys]End Sub[/FONT]
Change the bit in red to point to the column the file names are in and the bit in blue to the column you want the path written to.
 
Last edited:
Upvote 0
Hello,


The filenames are in collumn B and i would like the path of that filename in collumn C.

Best regards,


Flash :-)
 
Upvote 0
Our posts crossed on the bitstream. Try my code (above).
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,756
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top