ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel GOTO (https://www.excelbanter.com/excel-discussion-misc-queries/85854-excel-goto.html)

joeski

Excel GOTO
 
I need a GOTO macro. A number say "1001" is in cell A1. When I click on the
button, the macro references cell A1 and then takes the cursor to the cell
(in column A) that holds the value in A1.

joeski

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...lic.excel.misc

Dave Peterson

Excel GOTO
 
Put a button from the Forms toolbar on the sheet (near A1???) and assign it this
macro:

Option Explicit
Sub testme()

Dim res As Variant
Dim myRng As Range

With ActiveSheet
Set myRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
res = Application.Match(.Range("a1").Value, myRng, 0)
If IsError(res) Then
Beep 'not found
Else
Application.Goto myRng(res) ', scroll:=True
End If
End With
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

joeski wrote:

I need a GOTO macro. A number say "1001" is in cell A1. When I click on the
button, the macro references cell A1 and then takes the cursor to the cell
(in column A) that holds the value in A1.

joeski

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...lic.excel.misc


--

Dave Peterson

JE McGimpsey

Excel GOTO
 
One way (attach this macro to your button):

Public Sub MyGOTO()
Dim rFound As Range
Set rFound = Columns(1).Find( _
What:=Range("A1").Value, _
After:=Range("A1"), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
If Not rFound.Row = 1 Then _
rFound.Select
End Sub

In article ,
joeski wrote:

I need a GOTO macro. A number say "1001" is in cell A1. When I click on the
button, the macro references cell A1 and then takes the cursor to the cell
(in column A) that holds the value in A1.

joeski

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...=a7883949-0b41
-4694-8e22-e10c61c36bd1&dg=microsoft.public.excel.misc


joeski

Excel GOTO
 
Thanks guys
--
joeski


"joeski" wrote:

I need a GOTO macro. A number say "1001" is in cell A1. When I click on the
button, the macro references cell A1 and then takes the cursor to the cell
(in column A) that holds the value in A1.

joeski

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...lic.excel.misc



All times are GMT +1. The time now is 04:50 AM.

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