Help with VB Code

  • Thread starter Thread starter Josiah
  • Start date Start date
J

Josiah

OK...keep in mind I'm VERY new to VB. Look at this code:

Application.ScreenUpdating = False
With ActiveSheet
If Range("C23").Value <> "4C" Then
.CheckBoxes("Check Box 56").Value = False
msg = "Color is unavailable for this page using the selected pag
count."
MsgBox msg, vbOKOnly, "Runsheet Alert"
End If
End With



OK...Instead of range "C23" being limited to "4C", I want it to sa
something along the lines of:

If Range("C23").Value <> "4C" or "1C"

What's the proper way to write this
 
Hi Josiah,

It makes perfect sense, you have top repeat the item being tested

If Range("C23").Value <> "4C" Or Range("C23").Value <> "1C" Then

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hi
try the following line:
If Range("C23").Value <> "4C" or Range("C23").value <>"1C" Then
....

Frank
 
Bob said:
*Hi Josiah,

It makes perfect sense, you have top repeat the item being tested

If Range("C23").Value <> "4C" Or Range("C23").Value <> "1C" Then
*

Hmm...that didn't seem to work...now I get the alert message whether i
says "4C" *-or-* "1C"...I should get the alert message only if cell C2
is NOT equal to either of those two values, (4C or 1C)...




ANOTHER MUCH LESS IMPORTANT QUESTION:

You'll notcie the line, "Application.ScreenUpdating = False"

This should stop the screen from flashing when the macro is run...i
works usually, however in this instance, when I click my checkbox, th
screen still jumps (Without the code, there is no effect whatsoever).
Is there another way to stop this screen jump/flicker
 
Hi
replace the OR with AND:
If Range("C23").Value <> "4C" AND Range("C23").Value <> "1C" Then

Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top