R
Ray Batig
I am obviously missing something since I can't get this to work. I am
building a subroutine that will work on several worksheets. The Sub would be
initiated by clicking a button on the worksheet. To make it universal, I
need to pass the Worksheet name, the Range to be manipulated, a Range on
another worksheet which holds some data, and a constant. Here is what I have
tried.
On the Worksheet:
Private Sub CommandButton2_Click()
Dim WkSht As String, ANRange As Range, XlSlots As Range, RCol As Long
WkShts = "SheetName"
ANRange = Range("RangeName1")
XlSlots = Range("RangeName2")
RCol = 5
Call BuildReport( WkSht, ANRange, XlSlots, RCol)
End Sub
In Module:
Sub BuildReport( WkSht As String, ANRange As Range, XlSlots As Range, RCol
As Long)
Code
End Sub
Running this code produces a Run-time '1004' Application-defined or
object-defined error.
I have tried several other versions without success. What can I do to fix
this? Thanks in advance for your help!
Ray
building a subroutine that will work on several worksheets. The Sub would be
initiated by clicking a button on the worksheet. To make it universal, I
need to pass the Worksheet name, the Range to be manipulated, a Range on
another worksheet which holds some data, and a constant. Here is what I have
tried.
On the Worksheet:
Private Sub CommandButton2_Click()
Dim WkSht As String, ANRange As Range, XlSlots As Range, RCol As Long
WkShts = "SheetName"
ANRange = Range("RangeName1")
XlSlots = Range("RangeName2")
RCol = 5
Call BuildReport( WkSht, ANRange, XlSlots, RCol)
End Sub
In Module:
Sub BuildReport( WkSht As String, ANRange As Range, XlSlots As Range, RCol
As Long)
Code
End Sub
Running this code produces a Run-time '1004' Application-defined or
object-defined error.
I have tried several other versions without success. What can I do to fix
this? Thanks in advance for your help!
Ray