Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro ignores IF statement that refers to cell value
If INVCOUNT is a range name on a sheet you need to refer to it as such
otherwise VBA treats it as a variable name. If Sheets("Sheet Name").range("INVCOUNT") 0 Then PRINTFORM If the workbook where the range is defined is not the active workbook you would need to as that as well. -- If this helps, please remember to click yes. "Joe" wrote: I have a macro that loops thru about 50 locations and gathers information. In the interest of saving paper for a location with no data I don't want to print the locations report. I have a cell that counts the values on the sheet and only want to print if the count is greater than 0. I have the following in the macro, where INVCOUNT is the range name that counts cells with data and PRINTFORM is the macro that will print. If INVCOUNT 0 Then PRINTFORM The statement never seems to execute the PRINTFORM macro. However, if i just do PRINTFORM it will print all locations. What do I do? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro than refers to a cell? | Excel Discussion (Misc queries) | |||
Running macro in one workbook that refers to variable in another | Excel Programming | |||
Formula/macro that ignores cells nonblanks | Excel Discussion (Misc queries) | |||
Excel 2003 Macro ignores Arrow Keystrokes | Excel Discussion (Misc queries) | |||
macro button refers to prev. workbook | Excel Programming |