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: 11
Default Newbie: Problem with 'Select Case' testing syntax

Hi,

I'm trying to use a case list for conditional formating and thereby I'm
getting stuck with the syntax of the case conditions. Maybe someone
could point out why they don't work.

Here's what I have:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim IntColour As Integer

If Not Intersect(Target, Range("D9:Z14")) Is Nothing Then

Select Case True
Case Target = "c", "C"
IntColour = 50
Case Target Like "??"
IntColour = 3
Case Target = 1 To 9
IntColour = 54
Case Else
IntColour = 15
End Select
Target.Interior.ColorIndex = IntColour
End If

End Sub

The selection with 'Like' works fine, the others fail.

- Why does the one with the "c","C" not work? It works when I only have
"c", and it doesn't like OR either.

- Why doesn't the 1 To 9 work either? It works for 1 but not for the
other numbers.

Any help is appreciated.

Thanks a lot,
Thomas
 
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
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Select Case syntax Alan Beban Excel Programming 14 July 15th 07 11:51 PM
Select Case for Active Worksheet syntax. mikeburg[_43_] Excel Programming 2 December 2nd 05 12:26 AM
Syntax for Select Case Susan Hayes Excel Programming 4 November 30th 05 10:49 AM
Select Case syntax Susan Hayes Excel Programming 2 December 4th 04 10:42 PM


All times are GMT +1. The time now is 01:58 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"