+ Reply to Thread
Results 1 to 5 of 5

storing activecell.row value for later use?

  1. #1
    Registered User
    Join Date
    03-29-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    22

    storing activecell.row value for later use?

    Please Login or Register  to view this content.
    With the above, once the selection changes on the second line of code the 'a' active row location number will be different as the current selected cell has changed

    Is there a way to store the row number in the first 'ActiveCell.Row' line of code for reference in the 'Offset(a,0).Select

    Many thanks
    Last edited by hb316; 09-11-2013 at 06:33 AM.

  2. #2
    Registered User
    Join Date
    01-28-2013
    Location
    Manchester, England
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2010
    Posts
    50

    Re: storing activecell.row value for later use?

    It's not very clear what you're trying to do, but the line
    Please Login or Register  to view this content.
    will have already stored the row number of the original active cell. That's assuming that this is the start of your macro.
    It may help to post more of your macro code up to help with context.
    As it is, your code is using a row number to create an offset for the column being selected. I only point that out as your code differs from the line in your question where you have the variable 'a' offseting the row not the column.
    Syntax is Offset([row],[column])
    Please consider the * button if my post helped you

  3. #3
    Registered User
    Join Date
    03-29-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: storing activecell.row value for later use?

    yeah sorry, have changed the offset Syntax now

    Please Login or Register  to view this content.

    what Im trying to do is move horizontal to another location on a spreadsheet with a command button click instead of having to scroll

    with the code above i'm looking to move across to a column however would like to remain on the same active cell row when moving

    so if im on cell a100 on the first column and would like to move to the 'location' column which is 15 columns to the right, I would click on the command button and it will move to the column and keep me on the same row.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: storing activecell.row value for later use?

    Hi, hb316,

    maybe try it like this
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    won´t take you to the right (Columns) but down (Rows). So you should not look for the row but rather the column and add 15 to that.
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Registered User
    Join Date
    03-29-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: storing activecell.row value for later use?

    youre right bodi808 Activecell.row does store

    the code below worked perfect.

    Please Login or Register  to view this content.

+ 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. Output contents of Activecell when Activecell may be string or numeric.
    By jfriddle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2012, 12:27 PM
  2. How to set the Activecell of "Sheet2" to Activecell of "Sheet1"
    By shawnh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-06-2010, 11:12 PM
  3. storing value's
    By ashw1984 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2006, 12:25 PM
  4. Storing Values
    By dinesh in forum Excel General
    Replies: 0
    Last Post: 06-10-2005, 01:33 AM
  5. Storing a Value
    By Josh_123456 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2005, 06:26 PM

Tags for this Thread

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