Forum Discussion
Jenstarzie
Apr 30, 2025Copper Contributor
VBA Coding Help - Multiple Criteria 'If Range'
Hi, I'm relatively new to VBA in Excel and working on some improvements to a form I have created. As part of this, i would like a panel on the bottom of the form to unhide certain rows based on s...
Jenstarzie
May 01, 2025Copper Contributor
Hi, Thanks for your reply. Nothing happens at all at the moment so there is obviously something in the code that isn't registering. I will try adding the brackets around the groups and report back on how that goes.
m_tarler
May 01, 2025Bronze Contributor
so i threw the code into a vba sheet and it seems to "work".
A few tips and good practices to consider include
- defining the range object (e.g. ActiveSheet.Range.... or ActiveWorkbook.Sheets("MySheet").Range...)
- Use Breaks (click on gray bar to left of code to toggle break points) and Step through code (F8)
- Use the immediate window to 'try' things out (e.g. PRINT Activesheet.range("D9").value)
- highlight parts of the code and hover over it to see immediate value where possible
notice in this image I have a breakpoint on the IF, then hit F8 to move to the next line and highlighted the text/code "Range("D9").Value <= 450001" and hovered over it to see the tooltip/pop-up window showing that it evaluates to False
hope that helps