Goto location of another cell value

G

Guest

Hi All.....

If someone please, I am in need of code to select the cell in column B of
Sheet2, that contains a value matching that of cell B4 in Sheet1......and
then color the background of that cell RED. There will only be one cell in
Sheet2!B:B that will contain a matching value.

TIA
Vaya con Dios,
Chuck, CABGx3
 
G

Guest

Sub FindStuff()
dim rngToFind as range
dim rngToSearch as range
dim rngFound as Range

set rngToFind = Sheets("Sheet1").Range("B4")
set rngToSeach = Sheets("Sheet2").Columns("B")
set rngFound = rngToSeach.Find(What:=rngTofind.Value, _
LookAt:=xlWhole, _
Lookin:=xlFormulas, _
MatchCase:=False)
if rngFound is nothing then
msgbox "Sorry... Not Found"
else
rngFound.Inerior.ColorIndex = 3
end if
end sub
 
G

Guest

Oops. Typo...
rngFound.Inerior.ColorIndex = 3
should be
rngFound.Interior.ColorIndex = 3
 
G

Guest

LOL.........no problem Jim, I found that one too........many "Thank you's",
it works perfectly for me...........BTW, if I could impose a little more
please.......could this be modified to also color the 3 cells to the right
of the rngFound?

Thanks again,
Vaya con Dios,
Chuck, CABGx3
 
G

Guest

Sub FindStuff()
dim rngToFind as range
dim rngToSearch as range
dim rngFound as Range

set rngToFind = Sheets("Sheet1").Range("B4")
set rngToSeach = Sheets("Sheet2").Columns("B")
set rngFound = rngToSeach.Find(What:=rngTofind.Value, _
LookAt:=xlWhole, _
Lookin:=xlFormulas, _
MatchCase:=False)
if rngFound is nothing then
msgbox "Sorry... Not Found"
else
rngFound.Resize(,3).Interior.ColorIndex = 3
end if
end sub
 
G

Guest

So cool that is..................."it's easy when you know how", <g>

Thanks Jim, you da man!

Vaya con Dios,
Chuck, CABGx3
 

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

Top