Reputation: 93
Simple question for you experts out there.
Trying to figure out how to have cell A1 = sheetname.
I tried the following but got a compile error
y = Sheetname()
Range(A1) = y
Upvotes: 0
Views: 26850
Reputation: 1335
ActiveSheet.Range("A1") = ActiveSheet.Name
If you want it for every sheet, then
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Range("A1") = ws.Name
Next
Upvotes: 1