LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default Code doesn't go past first IF statement

That worked. Thanks. Any ideas on how to check 6 other ranges on the same sheet? With an if/elseif statement. It seems like if I put too much code in the worksheet_change sub some of the other code in the sub doesn't run too well. Any ideas? Thanks again. Matt

"keepITcool" wrote:

Matt wrote :

When I add NOT in the code, it doesn't do anything at all. Matt


Ouch :( Lets try again..

in this line Range("D10") Is Not Null

you are comparing a range OBJECT to Null... which wont work..

you want to check that the range is not an empty cell.

following is almost equivalent:
If NOT IsEmpty(Range("d10")) then
if Range("D10") < "" then
if Len(Range("d10") < 0 then
if Len(Trim(Range("d10")) < 0 then

'last one would also check for cells where
the user cleared the cell with his spacebar..

Re syntax:
in VBA syntax uses IS only to compare OBJECTS.
and that the Null value is not used very often in Excel.

Intersect(Target,Range("d10")) returns a range object
Compare it to the NOTHING object
Negate

would lead to : If NOT intersect(a,b) IS nothing
whereas If Intersect(a,b) IS NOT NOTHING gives a syntax error.



--
keepITcool

| www.XLsupport.com | keepITcool chello nl | amsterdam

 
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
Help Identifying code statement Ayo Excel Discussion (Misc queries) 1 November 29th 07 03:50 AM
If statement to replace #VALUE! code jeannie v Excel Worksheet Functions 8 June 27th 07 03:53 AM
Code execution skips Application.Run statement Stuart[_5_] Excel Programming 2 March 6th 04 07:11 PM
Simple code error statement Stuart[_5_] Excel Programming 7 March 3rd 04 08:47 PM
Quick VBA code question (if...then statement) abxy[_31_] Excel Programming 4 February 26th 04 01:04 AM


All times are GMT +1. The time now is 01:00 PM.

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

About Us

"It's about Microsoft Excel"