• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Find a value in a cell and jump to it

AntoPath

New Member
Hi all, I'm tryng to write a macro to go to a cell in column A containing a fixed value ("x"). The value "x" is entered to flag an entire row and use the entered values to build a report in another sheet. It would be great to jump, for example, from cell CK200 to A200 without having to scroll till to column A with just one click ....
Due to my incompetence and being absolutely new to VBA I 'm here to ask you a big help to solve this apparently huge problem.
Thank in advance to all :):)
 
Where is the fixed value located? In a particular cell? Or an input box that queries the user? Need this info to get you where you want to be. Here is an example using an input box.
Code:
Option Explicit

Sub FindX()
    Dim x As Variant, i As Long, lr As Long
    lr = Range("A" & Rows.Count).End(xlUp).Row
    x = InputBox("Find what?")
    For i = 1 To lr
        If Range("A" & i) = x Then
            Range("A" & i).Select
        End If
    Next i
End Sub
 
I select the row with the data to be printed, by writing an "x" in the row leading cell in column A, and use the data so far selected (in sheet "Input"), to build up and print a report in sheet "Stampa". It would be great to jump from the end of the selected row to its first cell in column A (where I entered the "x) with just a click ...
Thanks a lot !!!
 

Attachments

  • EXAMPLE.xlsb
    241.4 KB · Views: 6
In the attached, in the Input sheet, if you double-click or right-click any cell in columns T to X you will be taken to column A of the same row.
The code is in the Input sheet's code-module.
 

Attachments

  • Chandoo41728EXAMPLE.xlsb
    241.4 KB · Views: 7
WOOOOW !!!!! amazing p45cal !!!!! it looks magic !. How does it works ? The actions is triggered just double-clicking on the columnX range without the intervention of any macro :):):):):):):):)
Could it be possible to study the code ?
Absolutely conclusive. Thank you
 
As I said "The code is in the Input sheet's code-module."
Right - click the sheet's tab and choose View code.
 
Back
Top