Get the name of a newly copied worksheet
I am trying to copy a worksheet then make it active as shown in the code below, but the Set command
does not work. Is this the correct way to grab the identity of a newly copied worksheet? The
worksheet "Invoice Template" is hidden, so that's why the ".Visible" statement.
Set newSheet = Worksheets("Invoice Template").Copy befo=Worksheets(1)
With newSheet
.select
.Visible = xlSheetVisible
result = InputBox("Enter a name for your new invoice", "Name your invoice")
If result < "" Then
.Name = result
Else
.Name = "Invoice - " & Format(Date, "mmm_d_yyyy")
End If
end with
Thank you, Richard
|