How to use variable in code
Sorry about that, I had removed the "long" from the dim statement. I
just had "dim cap " which I believe initializes a varient. Should I be
using something else there? Thanks
BRC
JMay wrote:
Dim cap as Long <<< means cap is a long INTEGER!! (no decimals) RIGht?
HTH
"BRC" wrote:
sub filldata
dim cap as long
' for purpose this of illustration F16= .15
cap = Sheet4.Range("f16").Value
' to verify that cap is initialized
Msgbox(cap)
' for purpose of illustration c6=.20
Range("d6").Formula = "=IF(c6<0,0,IF(c6cap,cap,c6))"
end sub
If I replace "cap" with a number ( .15) it works fine but when I try to
use the variable cap I get a #name? error in the cells.
I believe I may not using correct punctuation around the variable. Any
suggestions Thanks
BRC
|