rarogersonkf
Programmer
The following code causes the error...
Run-time error '1004'
Application-defined or object-defined error.
Can someone explain what's wrong? (I figure that the new worksheet is not in the scope of the called subs but I'm not sure)
Private Sub CommandButton1_Click()
AddNewSheet
End Sub
Private Sub AddNewSheet()
Dim Newname As String
Newname = InputBox("Name for new worksheet?")
If Newname <> "" Then
Sheets.Add Type:=xlWorksheet
ActiveSheet.Name = Newname
End If
MakeHeader
End Sub
Private Sub MakeHeader()
Range("A1").Activate
Range("A1").Value = "Data refreshed..: " + Date$
End Sub
Thanks in advance for any insight.
Rob
Run-time error '1004'
Application-defined or object-defined error.
Can someone explain what's wrong? (I figure that the new worksheet is not in the scope of the called subs but I'm not sure)
Private Sub CommandButton1_Click()
AddNewSheet
End Sub
Private Sub AddNewSheet()
Dim Newname As String
Newname = InputBox("Name for new worksheet?")
If Newname <> "" Then
Sheets.Add Type:=xlWorksheet
ActiveSheet.Name = Newname
End If
MakeHeader
End Sub
Private Sub MakeHeader()
Range("A1").Activate
Range("A1").Value = "Data refreshed..: " + Date$
End Sub
Thanks in advance for any insight.
Rob