Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   Cell references within VBA in an Excel macro (https://www.askmehelpdesk.com/showthread.php?t=242316)

  • Jul 27, 2008, 04:34 PM
    rmccafferty
    Cell references within VBA in an Excel macro
    In a macro in Excel I want to refer to a cell where the user entered a number. I want that number to be the row number for the macro to move to. (I will then select the entire row and copy it to row 1, which I know how to do).

    How can I tell the macro which row to go to, using the number that has, in this case, been entered into cell A3? That is, if the user entered the number 11 in cell A3, how to I tell the macro to to to A11?

    I assume I need to use a variable. If so, I know how to declare the variable, but not the syntax for assigning a value to the variable in Excel or now to use that variable within a reference to a cell location.

    Thanks,
    Robert
    [email protected]
  • Jul 27, 2008, 11:46 PM
    JBeaucaire
    In the VBA code, the following line would do what you want:

    Range("A3").Select

  • All times are GMT -7. The time now is 05:32 AM.