Thread: Select Case
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
jlclyde jlclyde is offline
external usenet poster
 
Posts: 410
Default Select Case

On Jan 6, 1:41*pm, Mike H wrote:
Hi,

A couple of points. You haven't defined Rng and sheet4.range is incorrect
syntax.
The solution below used Sheets(4) which is the fourth worksheet in the
workbook irrespective of name. *But you could use

Sheets("Sheet4").Range("C4")

for the worksheet called Sheet4

Sub sonic()
Set Rng = Range("A1:A10")
For Each i In Rng
* * Select Case i
* * * * Case Is = Sheets(4).Range("C4")
* * * * * * i.EntireRow.Delete
* * End Select
Next i

End Sub


Mike


Mike, thanks for the points. Rng is defined earlier in the code. I
only included what i thought would help someone understand shat I
needed help with. I was also trying to use Sheet4 and not a sheet
named 4 or Sheet 4. What you suggested still does not work. I will
try to explain a little differently.

I have a Select Case i. I want to see if i = any of the values in C4
on the other sheet. All of the vlaues are in C4. It is inserted as
text to accomodate all teh numbers.

Or is there another way to include multiple numbers as one case in
excel? Maybe from a range?

Thanks,
Jay