+ Reply to Thread
Results 1 to 6 of 6

Using a variable with the offset function

  1. #1
    Registered User
    Join Date
    04-04-2013
    Location
    Hortonville, WI
    MS-Off Ver
    Excel 2010
    Posts
    6

    Using a variable with the offset function

    [SOLVED] I have a row number defined in a variable (FHRow1) and I want to use that row number to offset from the active cell. I am using the following:
    ActiveCell.Offset(-FHRow1,0).Select and it does not work. What is the correct syntax for what I am trying to do?
    Thanks!
    Last edited by bbatterman; 08-05-2013 at 03:38 PM. Reason: [SOLVED]

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Using a variable with the offset function

    Please Login or Register  to view this content.
    Means you are selecting a row above the active cell. If the active cell is A1, you will get a syntax error as there is no cell above A1.

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Using a variable with the offset function

    Post the code. Remember to use [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE]
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    04-04-2013
    Location
    Hortonville, WI
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Using a variable with the offset function

    The active cell is, say A35. The variable value for FHRow1 is 7. I am trying to get the code to offset to A28 using ActiveCell.Offset(-7,0).Select where the "7" is brought in with the variable FHRow1.

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Using a variable with the offset function

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-04-2013
    Location
    Hortonville, WI
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Using a variable with the offset function

    That did it! Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. function similar to offset to offset the offset
    By Jerseynjphillypa in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-03-2012, 03:07 PM
  2. Using variable in OFFSET function
    By kmoore in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2011, 12:13 PM
  3. OFFSET function with variable reference cell
    By smile2leksa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2009, 08:32 AM
  4. Offset with variable?
    By John in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2006, 03:35 PM
  5. [SOLVED] Offset with variable
    By James in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2005, 04:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1