ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving one cell over to the right (https://www.excelbanter.com/excel-programming/291752-moving-one-cell-over-right.html)

alexm999[_49_]

Moving one cell over to the right
 
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..

--
Message posted from http://www.ExcelForum.com


alexm999[_50_]

Moving one cell over to the right
 
I fixed my dilemma...

here's the code:

ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate


---
Message posted from http://www.ExcelForum.com/


Ron de Bruin

Moving one cell over to the right
 
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


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"alexm999 " wrote in message ...
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 need
a script that will then highlight the cell in c1.

Sometimes, though the item i search for can be in cell D46 or a random
area...


---
Message posted from http://www.ExcelForum.com/




alexm999[_51_]

Moving one cell over to the right
 
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?


---
Message posted from http://www.ExcelForum.com/


Ron de Bruin

Moving one cell over to the right
 
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


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"alexm999 " wrote in message ...
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?


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 02:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com