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 |
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 |
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 |
All times are GMT +1. The time now is 07:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com