Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default case select and a range

Instead of listing all of the valid values, I would like
to use a range name in a case select statement. Is this
possible. Following is the code I'm using without much
success. "VV" is the name of the range that contains the
values I want to check against.

Sub find_match()

Select Case cell

Case ("VV")
counter = counter + 0

Case Else

ActiveCell.Interior.ColorIndex = 6
counter = counter + 1

End Select

End Sub

Thanks for the help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default case select and a range

You won't be able to use a Select statement, but you probably can use a For
Each, depending on what you're really trying to do.

Sub find_match()
Dim rngT as Cell
For Each rngT in Range("VV")
If cell.value = rngT.value Then
counter = counter + 0
Else
ActiveCell.Interior.Color = 6
counter = counter + 1
End If
Next rngT
End Sub

Hope this helps
By the way, why bother incrementing the counter by 0?

"JT" wrote in message
...
Instead of listing all of the valid values, I would like
to use a range name in a case select statement. Is this
possible. Following is the code I'm using without much
success. "VV" is the name of the range that contains the
values I want to check against.

Sub find_match()

Select Case cell

Case ("VV")
counter = counter + 0

Case Else

ActiveCell.Interior.ColorIndex = 6
counter = counter + 1

End Select

End Sub

Thanks for the help



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default case select and a range

Sub find_match()
counter = 0
For Each cell In Range("A1:A10")
Select Case True
Case Not IsError(Application.Match(cell, Range("VV"), 0))
counter = counter + 0
Case Else
ActiveCell.Interior.ColorIndex = 6
counter = counter + 1
End Select
Next
Range("B1") = counter
End Sub


--
Regards,
Tom Ogilvy


"JT" wrote in message
...
Instead of listing all of the valid values, I would like
to use a range name in a case select statement. Is this
possible. Following is the code I'm using without much
success. "VV" is the name of the range that contains the
values I want to check against.

Sub find_match()

Select Case cell

Case ("VV")
counter = counter + 0

Case Else

ActiveCell.Interior.ColorIndex = 6
counter = counter + 1

End Select

End Sub

Thanks for the help



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
Case Select NoodNutt Excel Worksheet Functions 7 September 21st 08 02:10 AM
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Select Case Susan Hayes Excel Programming 1 November 4th 04 08:37 PM
Need help on Select Case Susan Hayes Excel Worksheet Functions 1 November 3rd 04 10:25 PM
select case help please Christine Flott[_2_] Excel Programming 4 July 29th 03 09:05 PM


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