Sub Macro1()
For i = 1 To Worksheets.Count
Sheets(1).Cells(i, 1) = Sheets(i).Name
Next
End Sub
This is only a simple example. It take each sheet name and deposits it in
column A of the first sheet.
--
Gary''s Student
" wrote:
Hi,
I'm new to this. Would appreciate advice on the following issue about a
macro in VB:
I want to loop through a folder and get all the file names in the
folder. Then I will then set the cell values on "C" column in "Sheet2"
to these file names. What's the correct syntax for setting the cell
values?
I'm looking for something like:
Dim i As Integer
i = 1
For Each fileName In fileNames
i++;
Sheet2.Cell(i,3).value = fileName;
Next
Clearly this doesn't work because the syntax is not correct. Any input?
Many thanks!
-Emily