H
Howard
In a worksheet named Title Generator I am trying to use a UserBox to name a
range then copy that range to a sheet named Sessions, per the code below.
This is producing appl. define or object defined error.
ActiveWorkbook.Names.Add Name:="SName", _
RefersTo:="=(Title Generator)$B$12:$T$503"
This is producing subscript out of range error.
ActiveWorkbook.Names.Add Name:="SName", _
RefersTo:="=Title Generator!$B$12:$T$503"
Option Explicit
Sub ToSessionSheet()
Dim SName As String
SName = InputBox("Enter a Session Name", "Session Name")
'MsgBox SName
If SName = vbNullString Then Exit Sub
ActiveWorkbook.Names.Add Name:="SName", _
RefersTo:="=(Title Generator)$B$12:$T$503"
Range(SName).Copy Sheets("Sessions").Range("B10000").End(xlUp).Offset(1, 0)
SName = vbNullString
End Sub
Thanks.
Howard
range then copy that range to a sheet named Sessions, per the code below.
This is producing appl. define or object defined error.
ActiveWorkbook.Names.Add Name:="SName", _
RefersTo:="=(Title Generator)$B$12:$T$503"
This is producing subscript out of range error.
ActiveWorkbook.Names.Add Name:="SName", _
RefersTo:="=Title Generator!$B$12:$T$503"
Option Explicit
Sub ToSessionSheet()
Dim SName As String
SName = InputBox("Enter a Session Name", "Session Name")
'MsgBox SName
If SName = vbNullString Then Exit Sub
ActiveWorkbook.Names.Add Name:="SName", _
RefersTo:="=(Title Generator)$B$12:$T$503"
Range(SName).Copy Sheets("Sessions").Range("B10000").End(xlUp).Offset(1, 0)
SName = vbNullString
End Sub
Thanks.
Howard