Move cursor to specific cell in a column based on value in another cell

Blanchetdb

Board Regular
Joined
Jul 31, 2018
Messages
159
Office Version
  1. 2016
Platform
  1. Windows
Hi

seeking for a VBA code to do the following:

I would like the cursor to move to a cell in column A - where the value in column AC of that same row matches cell value in G5

example:
value in cell G5 is "ICA-2023 (Tom)"
value in cell A10 is "ICA-2023"
value in cell AC10 is "ICA-2023 (Tom)"
the cursor goes to cell A10

any help would be greatly appreciated
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
@Blanchetdb Maybe like below.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Or Intersect(Target, Cells(5, 7)) Is Nothing Then Exit Sub
Cells(Application.WorksheetFunction.Match(Target, Range("AC:AC"), 0), 1).Select
End Sub
 
Upvote 0
@Blanchetdb Maybe like below.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Or Intersect(Target, Cells(5, 7)) Is Nothing Then Exit Sub
Cells(Application.WorksheetFunction.Match(Target, Range("AC:AC"), 0), 1).Select
End Sub
tried but nothing happened ....

the command button is located on sheet name "ScienceDADMonitoring". I inserted the code on that page and then tried creating a new module ... still nothing happening
 
Upvote 0
Sorry, I assumed that you would be wanting an automatic reaction to having changed the value in G5. Hence I used the Worksheet_Change event (thus no button involved). If that were to have been relevant then it would need to be in the sheet code pane.
If using a button on the same page a then try below.

VBA Code:
Sub Go_ColA()
Cells(Application.WorksheetFunction.Match(Cells(5, 7), Range("AC:AC"), 0), 1).Select
End Sub
 
Upvote 1
Solution
Sorry, I assumed that you would be wanting an automatic reaction to having changed the value in G5. Hence I used the Worksheet_Change event (thus no button involved). If that were to have been relevant then it would need to be in the sheet code pane.
If using a button on the same page a then try below.

VBA Code:
Sub Go_ColA()
Cells(Application.WorksheetFunction.Match(Cells(5, 7), Range("AC:AC"), 0), 1).Select
End Sub
awesome .... thank you
 
Upvote 0

Forum statistics

Threads
1,216,555
Messages
6,131,372
Members
449,646
Latest member
dwalls

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top