Moving one cell over to the right

  • Thread starter Thread starter alexm999
  • Start date Start date
A

alexm999

using VB code, i need to move over to the right 1 cell.

For example, i search for something and it finds it in cell b1, i nee
a script that will then highlight the cell in c1.

Sometimes, though the item i search for can be in cell D46 or a rando
area..
 
I fixed my dilemma...

here's the code:

ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
 
See the VBA help for Offset

Try something like this

Sub test()
On Error GoTo a
Range("a1:a100").Find("ron").Offset(0, 1).Select
Exit Sub
a: MsgBox "nothing found"
End Sub
 
Whats the script for the following:

If I look for a something and it's not there, what can i use to do
nothing and look for something else?
 
Try Something like this

Sub test()
Dim rng As Range
On Error Resume Next
Set rng = Range("a1:a100").Find("ron")
If rng Is Nothing Then
Set rng = Range("a1:a100").Find("dave")
End If
If Not rng Is Nothing Then
rng.Offset(0, 1).Select
Else
MsgBox "nothing found"
End If
End Sub
 
Back
Top