Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making all text become lower case amik Excel Discussion (Misc queries) 1 June 8th 09 03:15 PM
Making Sheet all Upper Case Junderwood57 Excel Discussion (Misc queries) 3 June 25th 08 02:29 PM
IF STATMENT OR CASE STATEMENT Richard Excel Discussion (Misc queries) 2 January 10th 07 10:04 AM
Making a cell's contents lower case KimberlyC Excel Worksheet Functions 4 May 4th 05 11:23 PM
Fix If statment to accept Upper or Lower Case rleonard[_2_] Excel Programming 3 June 5th 04 10:54 PM


All times are GMT +1. The time now is 10:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"