Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to look through a range of cells to see if there is a match to a
variable I have previously set. What is the syntax for referencing this range? Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim rng as Range, rng1 as Range
Dim myVar as String myVar = "Amy" set rng = Range("B9:F100") set rng1 = rng.find(myVar) if not rng1 is nothing then msgbox myvar & " found at " & rng1.Address Else msgbox myvar & " was not found in " & rng.Address End sub -- Regards, Tom Ogilvy "Ann" wrote in message ... I need to look through a range of cells to see if there is a match to a variable I have previously set. What is the syntax for referencing this range? Thanks. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For Each c In Range("A1:A10")
If c.Text = "WHATEVER YOUR LOOKING FOR" Then ..... Do what you want here End If Next c In the example change the range to whatever you want and the check condition. This way you have multiple check conditions within a case statement and as each cell is returned you can manipulate each cell very easily. "Ann" wrote in message ... I need to look through a range of cells to see if there is a match to a variable I have previously set. What is the syntax for referencing this range? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
reference cells when looping | Excel Discussion (Misc queries) | |||
Looping thru a range of cells | New Users to Excel | |||
Looping on Cells with $x$y | Excel Programming | |||
Looping through Cells | Excel Programming | |||
Looping through a range of cells | Excel Programming |