Hello,
I have a macro that creates a new sheet and names it based on cell data. I would like to add some VBA to place the new sheet right next to the template sheet, In this case the template sheet is always the first sheet shown on the bottom of the workbook. Here is my code i have so far:
Thank you!
I have a macro that creates a new sheet and names it based on cell data. I would like to add some VBA to place the new sheet right next to the template sheet, In this case the template sheet is always the first sheet shown on the bottom of the workbook. Here is my code i have so far:
VBA Code:
Sub Copyrenameworksheet4()
'Updateby Extendoffice
'This macro creates a new sheet based on data name in Cell M2 then clears data on original page.
Dim wh As Worksheet
Range("M2").Select
Set wh = Worksheets(ActiveSheet.Name)
wh.Copy After:=Worksheets(Sheets.Count)
If wh.Range("M2").Value <> "" Then
ActiveSheet.Name = wh.Range("M2").Value
wh.Range("M2:M8").ClearContents
wh.Range("M5") = 1
wh.Range("M7") = 1
Range("L14").Select
End If
End Sub
Thank you!