ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Names of worksheets (https://www.excelbanter.com/excel-programming/275776-names-worksheets.html)

Mac[_4_]

Names of worksheets
 
Hi all,
I am using a set of excel sheets to do some costing.
Because I have multiple sheets ( changes every project ) I
was hoping to write some code to copy the fields from each
sheet ( let just say A3 ) to the final costing sheet. To
do this I thought about assigning a variable to the name
of each sheet and using the variable to wite the formula.
Unfortunately I have trouble with the assigning of the
variable to the sheet name. I started with something
similar to this

For i = 1 To Worksheets.Count
tmpName = "sheets" & i
SName = Worksheets(tmpName).Name
does a) anybody understand my problem and b) can anyone
help
Thanks in Advance
MM


Cecilkumara Fernando

Names of worksheets
 
Mac,
Try

Sub checkData()
For a = 1 To Sheets.Count
Range("K" & a) = Sheets(a).Range("A3").Value
Next a
End Sub

if the final costing sheet is the last one of the book
you can use
For a = 1 To Sheets.Count - 1
to get the values of the rest
HTH
Cecil


"Mac" wrote in message
...
Hi all,
I am using a set of excel sheets to do some costing.
Because I have multiple sheets ( changes every project ) I
was hoping to write some code to copy the fields from each
sheet ( let just say A3 ) to the final costing sheet. To
do this I thought about assigning a variable to the name
of each sheet and using the variable to wite the formula.
Unfortunately I have trouble with the assigning of the
variable to the sheet name. I started with something
similar to this

For i = 1 To Worksheets.Count
tmpName = "sheets" & i
SName = Worksheets(tmpName).Name
does a) anybody understand my problem and b) can anyone
help
Thanks in Advance
MM





All times are GMT +1. The time now is 04:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com