Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you can try this
Range("d6").Formula = "=IF(c6<0,0,IF(c6" & cap & "," & cap & ",c6))" -- Gary "BRC" wrote in message ups.com... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
can i link a variable cost code with a variable sum | Excel Discussion (Misc queries) | |||
Variable within the code | Excel Programming | |||
variable code?? | Excel Discussion (Misc queries) | |||
variable code | Excel Programming | |||
Variable in a VB Code | Excel Programming |