Hi,
i wrote this code to truncate a cell in a sheet, then rename it with the new value of this cell and delete the whole row afterwards. I need this to loop through all the sheets with the value of B1.
here is what i have so fare but it doesn't seem to work.
i wrote this code to truncate a cell in a sheet, then rename it with the new value of this cell and delete the whole row afterwards. I need this to loop through all the sheets with the value of B1.
here is what i have so fare but it doesn't seem to work.
Code:
Dim workS As Worksheet
For Each workS In ActiveWorkbook.Worksheets
' Truncating "section" cell
ActiveCell = Left(Range("B1"), 9)
' Replacing blanks by underscore for renaming purposes
ActiveCell = Replace(ActiveCell, " ", "_")
'Replacing "SheetX" with the name of the section
Dim ws1 As Worksheet
Set ws1 = ActiveSheet
ws1.Name = ws1.Range("A1")
'deleting row 1
Selection.EntireRow.Delete
Next workS
Last edited: