Harddisk
Sep 25th, 2003, 08:01 AM
Hi,
I have this dummy cell, which I assign a custom sub to it using this way, for eg:
Range("A3").FormulaR1C1Local = "=Count(R[-2]C)"
Based on the formula, I passed in Cell "A1" into sub Count as parameter. Hence, when I key in anything in Cell "A1", it will execute Count sub.
The problem is, in my Count sub, I have something like this
Public Sub Count(iInvalue as Integer)
Range("A2").Value = iInvalue * 3
End Sub
Upon executing the line in Count sub, it will exit the Sub with an error
Run-time error '1004':
Application-defined or object-defined error
I was able to retrieve value from cell on the sheet though, such as
sValue = Range("A4").Value
or display a message box
msgbox "Not working"
I just can't alter value on the Cell. The worksheet is newly opened, which is NOT protected or anyhow.
Does anyone has any idea what happened?
Please advise.
Thank you.
I have this dummy cell, which I assign a custom sub to it using this way, for eg:
Range("A3").FormulaR1C1Local = "=Count(R[-2]C)"
Based on the formula, I passed in Cell "A1" into sub Count as parameter. Hence, when I key in anything in Cell "A1", it will execute Count sub.
The problem is, in my Count sub, I have something like this
Public Sub Count(iInvalue as Integer)
Range("A2").Value = iInvalue * 3
End Sub
Upon executing the line in Count sub, it will exit the Sub with an error
Run-time error '1004':
Application-defined or object-defined error
I was able to retrieve value from cell on the sheet though, such as
sValue = Range("A4").Value
or display a message box
msgbox "Not working"
I just can't alter value on the Cell. The worksheet is newly opened, which is NOT protected or anyhow.
Does anyone has any idea what happened?
Please advise.
Thank you.