LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default "If Not.." crashes

I have a macro which tells Excel to run through a list of cells
and print a worksheet if the content of the cell satisfies two
conditions. The first one is that the content of the cell should
match the content of a cell named "Restrict". This works.

The other condition is that the cell should not contain a question
mark. I can't get this to work. The macro works fine if I let it
look for a "?" and then print if it finds one - but I want the
opposite, cells with "?" in them should be ignored.

This is the code that works:

If Left(ActiveCell, Len(Range("Restrict"))) = Range("Restrict") _
Then
If InStr(1, ActiveCell, "?") Then

[Code for print-out]

End If
End If


I've tried to amend the second line like this:

If Not(InStr(1, ActiveCell, "?")) Then

and

If InStr(1, ActiveCell, "?") = 0 Then

but when I try to run the macro, Excel freezes up before
finishing.

What am I doing wrong here??

 
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
Excel Crashes when typing "False" in VLookup formula pcbins Excel Worksheet Functions 11 May 13th 11 10:47 AM
Excel crashes when typing "false" in VLookup function pcbins Excel Worksheet Functions 18 January 30th 09 09:24 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Excel crashes on "Close" Visual Basic error 400 [email protected] Excel Discussion (Misc queries) 3 March 19th 08 03:45 PM
Excel 2000 crashes after "touching" a userform with the mouse and closing it Chris J Mercer Excel Programming 0 October 1st 03 08:41 AM


All times are GMT +1. The time now is 09:12 AM.

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"