How to go to a specific cell with a macro

Glen27 -  
eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   -
Hello,

I need to go to a specific cell using a macro.

I know how to do it "live" (Go To), but I can't do it with the macro, which I know the cell coordinates of (which change each time), but I can't specify it in the macro.

Thank you in advance for your help.

Best regards

Configuration: Windows 7 / Firefox 30.0

3 answers

  1. ccm81 Posted messages 11033 Status Member 2 434
     
    Hello and hi Patrice

    If you really want a macro
    Range(adr).select
    or
    Cells(li,co).select

    Best regards
    1
  2. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
     
    Hello,

    to select it and make it visible in the window (scrolling):
    Application.Goto [A1], True

    eric

    --
    By trying continuously, you eventually succeed.
    So the more it fails, the more chances we have that it works. (the Shadoks)
    In addition to the thank you (yes, indeed, it's done!!!), remember to mark it as resolved. Thanks
    0
    1. ccm81 Posted messages 11033 Status Member 2 434
       
      Hi Eric

      Under my old Excel 2003, .select is enough to make it visible in the window

      Best regards
      0
    2. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
       
      yes, exactly, I explained myself very poorly.
      Let's say it's more to make the cells below and to the right visible.
      If your last visible row is 36, .select selects it without scrolling. With application.goto ..., true you make the cells below and to the right visible.
      It can be useful in certain cases.

      eric
      0
  3. Patrice33740 Posted messages 8400 Registration date   Status Member Last intervention   1 783
     
    Hello,

    To reach a cell, you only need to type its address directly into the name box (located to the left of the formula bar).

    What is the point of using a macro that you have to run (1st action) and then input (for example via an input box) the cell address (2nd action) and finally validate, to achieve the same result???

    --
    Best regards
    Patrice
    -1
    1. Patrice33740 Posted messages 8400 Registration date   Status Member Last intervention   1 783
       
      Maybe I should have asked:
      Why keep it simple when you can make it complicated????
      0