Simi
New member
- Joined
- Feb 10, 2012
- Messages
- 190
- Reaction score
- 0
- Points
- 0
- Location
- Utah, USA
- Excel Version(s)
- Version 2002 Build 12527.20194
I am trying to copy data from a large spreadsheet to smaller parsed out versions. And I can not seem to get the code to work properly for how I am referring to the cells.
in this example, newSheetName is the name of the active sheet, in the active workbook.
wipWorkbook is a predefined string from the user.
this string works within the same workbook provided there is a W-I-P sheet in the same workbook as newSheetName
Worksheets(newSheetName).Cells(1, cellCount) = Worksheets("W-I-P").Cells(1, cellCount)
in this example, newSheetName is the name of the active sheet, in the active workbook.
wipWorkbook is a predefined string from the user.
Code:
'Example
'copy the header rows from W-I-P
For cellCount = 1 To 40
Worksheets(newSheetName).Cells(1, cellCount) = Workbooks(wipWorkbook).Worksheets("W-I-P").Cells(1, cellCount)
Next cellCount
'End of Example
this string works within the same workbook provided there is a W-I-P sheet in the same workbook as newSheetName
Worksheets(newSheetName).Cells(1, cellCount) = Worksheets("W-I-P").Cells(1, cellCount)