Hi,
I'm trying to write a Sub to return a range that will be used later. I want to use an InPutBox to select the desired data then return the number of columns for later computations. An error '424' - object required, is returned regardless of how I define rRange.
The error is at Set rRange=...
My humble code follows:
Sub MarkFactor6()
Dim rRange As Range
Dim numCols As Integer
Set rRange = Application.InputBox _
(Prompt:="Select data range", _
Title:="PRINT RANGE", Type:=8)
numCols = Selection.Columns.Count
MsgBox numCols
End Sub
I'm trying to write a Sub to return a range that will be used later. I want to use an InPutBox to select the desired data then return the number of columns for later computations. An error '424' - object required, is returned regardless of how I define rRange.
The error is at Set rRange=...
My humble code follows:
Sub MarkFactor6()
Dim rRange As Range
Dim numCols As Integer
Set rRange = Application.InputBox _
(Prompt:="Select data range", _
Title:="PRINT RANGE", Type:=8)
numCols = Selection.Columns.Count
MsgBox numCols
End Sub