Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Newbie question - Cell Reference [email protected] New Users to Excel 1 May 31st 06 02:43 AM
Newbie Cell Reference Question... UncleRemus New Users to Excel 2 October 30th 05 12:02 PM
Newbie Question - Moving text from one cell to another Buritoking[_2_] Excel Programming 3 July 20th 04 09:58 PM
Newbie Question: Returning the value from a cell on another sheet SmilingPolitely[_2_] Excel Programming 4 July 14th 04 01:23 PM
Newbie question on cell reference 2 Mfaces Excel Programming 5 December 9th 03 07:58 PM


All times are GMT +1. The time now is 01:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"