Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Making a C++ like if statment case for excel in VBA
i need to have code line look at a cell, say L20, which is a drop box
(yes/no). If the box says yes it then needs to remove the user data from cells N20-T20. If it says no, it does nothing. I know that im gonna have a if/then/else/end if statement. but i havent written in VBA in years, and im quite rusty since im used to Java at this point. Also this needs to be for a 500 cell deep spreadsheet. I wasnt to fond of the idea of making 499 different statments for this, but i can understand if thats the only way. Someone please help me with this, since i dont want to do this in Java and integrate into a excel sheet, when im not the primary user. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Making a C++ like if statment case for excel in VBA
Jimmy, where've you been?
Try something like this: Dim rCell as Range Dim rRng as Range Set rRng = Sheet1.Range("L20:L519") For Each rCell in rRng.Cells If rCell.Value = "yes" Then rCell.Offset(0,2).Resize(1,7).ClearContents End If Next rCell -- Dick Kusleika Excel MVP Daily Dose of Excel www.dicks-blog.com Jimmy Hoffa wrote: i need to have code line look at a cell, say L20, which is a drop box (yes/no). If the box says yes it then needs to remove the user data from cells N20-T20. If it says no, it does nothing. I know that im gonna have a if/then/else/end if statement. but i havent written in VBA in years, and im quite rusty since im used to Java at this point. Also this needs to be for a 500 cell deep spreadsheet. I wasnt to fond of the idea of making 499 different statments for this, but i can understand if thats the only way. Someone please help me with this, since i dont want to do this in Java and integrate into a excel sheet, when im not the primary user. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Making all text become lower case | Excel Discussion (Misc queries) | |||
Making Sheet all Upper Case | Excel Discussion (Misc queries) | |||
IF STATMENT OR CASE STATEMENT | Excel Discussion (Misc queries) | |||
Making a cell's contents lower case | Excel Worksheet Functions | |||
Fix If statment to accept Upper or Lower Case | Excel Programming |