stt_d31
May 17th, 2005, 09:06 AM
Hello,
I have one simple worksheet and one simple command button on it.
In the code of the command button i specify a software coded range and and by clicking the command button, the worksheet_change function needs to explicitly executed with this range.
However, there seems to be an error by passing the range that i specified in the code of the command button.. I get the error 'runtime error 424', 'object required'.
can anyone tell me what's wrong with this simple piece of code .
Public Sub CommandButton1_Click()
Dim r As Range
Set r = Range("A1:B5")
Worksheet_Change (r)
End Sub
Public Sub Worksheet_Change(ByVal Target As Range)
MsgBox Target.Cells.Count
End Sub
thanks in advance
I have one simple worksheet and one simple command button on it.
In the code of the command button i specify a software coded range and and by clicking the command button, the worksheet_change function needs to explicitly executed with this range.
However, there seems to be an error by passing the range that i specified in the code of the command button.. I get the error 'runtime error 424', 'object required'.
can anyone tell me what's wrong with this simple piece of code .
Public Sub CommandButton1_Click()
Dim r As Range
Set r = Range("A1:B5")
Worksheet_Change (r)
End Sub
Public Sub Worksheet_Change(ByVal Target As Range)
MsgBox Target.Cells.Count
End Sub
thanks in advance