Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie Question on Setting Cell Value in Sheet2
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Newbie Question on Setting Cell Value in Sheet2
Sorry, I crossed a post. See:
http://groups.google.com/group/micro...f723f961b67c46 -- 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with Newbie question - Cell Reference | New Users to Excel | |||
Newbie Cell Reference Question... | New Users to Excel | |||
Newbie Question - Moving text from one cell to another | Excel Programming | |||
Newbie Question: Returning the value from a cell on another sheet | Excel Programming | |||
Newbie question on cell reference 2 | Excel Programming |