Reputation: 885
I am trying to round out a rather large macro by copy and pasting the newly parsed data into a newly created sheet that is named with the date, which I am storing in cell B2 in the data insert sheet. So put most simply, I want to create a new sheet and name it with the contents (a date) in cell B2 located in a different sheet.
ActiveSheet.Range("A3:Q" & lastRow).Select
Selection.Copy
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
Sheets(ActiveSheet.Name).Name = ActiveWorkbook.Sheets(Trade_Data_Insert).Range("B2")
Upvotes: 1
Views: 1044
Reputation: 7979
Change your macro to
Dim newSht As Worksheet
ActiveSheet.Range("A3:Q" & lastRow).Select
Selection.Copy
Set newSht = ActiveWorkbook.Sheets.Add(, Worksheets(Worksheets.Count))
newSht.Name = ActiveWorkbook.Sheets(Trade_Data_Insert).Range("B2").Value
also... is Trade_Data_Insert
a set variable? if its the name you need to put it in ""
Upvotes: 1