View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] fir5tsight@yahoo.com is offline
external usenet poster
 
Posts: 2
Default Newbie Question on Setting Cell Value in Sheet2

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