View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default 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.