Hi
I have a workbook with 240 worksheets.
Name of each worksheet is a date with format "dd.mm.yyyy".
Each worksheet has an empty column A.
With the attached VBA I am able to correctly place "Date" in A1 of all sheets.
The minimum I want to place the name of each sheet in A2 of the sheet the name originates from.
However my code paste a name of active worksheet to all sheets, which is not what I want to do.
I want each sheet has in A2 its own sheet name.
How should I replace "activeSheet.Name" to achieve this?
If it is not a problem, could you also help me how to then modify the VBA code with the following logic:
After placing "Date" in A1 of all sheets, place name of the worksheet in cell range A2 -AX, where X is the last row where CX has a value (aka CX+1) is first empty cell in C1 to CX+1 range.
(I have chosen column C as column B has some empty cells before the end of the data range; each sheet has a different number of rows).
Thank you very much for the help with at lest the first part of my query!
I have a workbook with 240 worksheets.
Name of each worksheet is a date with format "dd.mm.yyyy".
Each worksheet has an empty column A.
With the attached VBA I am able to correctly place "Date" in A1 of all sheets.
The minimum I want to place the name of each sheet in A2 of the sheet the name originates from.
However my code paste a name of active worksheet to all sheets, which is not what I want to do.
I want each sheet has in A2 its own sheet name.
How should I replace "activeSheet.Name" to achieve this?
If it is not a problem, could you also help me how to then modify the VBA code with the following logic:
After placing "Date" in A1 of all sheets, place name of the worksheet in cell range A2 -AX, where X is the last row where CX has a value (aka CX+1) is first empty cell in C1 to CX+1 range.
(I have chosen column C as column B has some empty cells before the end of the data range; each sheet has a different number of rows).
Thank you very much for the help with at lest the first part of my query!
VBA Code:
Sub myscript()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A1").Value = "Date"
ws.Range("A2").Value = activeSheet.Name
Next ws
End Sub