+ Reply to Thread
Results 1 to 9 of 9

How to move to specified column staying on same row

  1. #1
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    How to move to specified column staying on same row

    I've tried to look up the following requests in help, but could find nothing, so I need help. I'm certainly open to suggestions on how I could find this code thru help.


    Actually, I have need of 2 lines of code for the following movements by macro.

    First . . .
    I have the cell address L11 saved in ss - or any other column to the right on row 11.
    (The location can be changed by operator prior to running the macro)
    When the macro runs, the activecell always becomes B12.
    I want the last cell in column L (or whatever cell is saved in ss) to be selected, thereby becoming the new activecell.

    Thats all for this one.


    SECOND . . .
    Second, my activecell is located in any column and let's say on row 17. The activecell will always be to the right of column L .
    I need to always move the selection, staying on the same row, to column L .

    That's it.

    Thanks in advance for the great help.
    Last edited by Launchnet; 06-02-2010 at 06:45 PM.
    Thanks for helping . . .
    Matt @ Launchnet

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: How to move to specified column staying on same row

    Hi Launchnet
    the second maybe....
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: How to move to specified column staying on same row

    and I think the first maybe

    Please Login or Register  to view this content.
    where A1 has the cell reference say B12

  4. #4
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    Re: How to move to specified column staying on same row

    Hi Pike

    I have re-written what I need. I think this time it will be more understandable.

    FIRST . . .
    I have the cell address L11 saved in the variable ss - or could be any other column to the right on row 11. The cell address in ss could be such as: N11 or O11 or R11 or Z11 anyplace on row 11. This is to say that the cell address in ss will always be on row 11 and any column to the right of column E. (The selection can be changed by the operator prior to running the macro)

    When the macro runs, the activecell always becomes B12. I can add code to my macro that will set the activecell to the current ss value which is - L11 for our example. Now, I want the activecell changed to L65536. What I need to know is how to change the now activecell L11 to the last cell in the column which is L65536 ?

    Another way of stating it would be to say: Move the active cell from L11 to L65536 or N11 to N65536 or R11 to R65536 and so forth.

    This allows me to find the last cell in whatever column is in ss that has data in it

    I don't see how


    Please Login or Register  to view this content.
    finds the bottom cell L65536 or whatever column is indicated in ss.

    Hope this gives a better description.

    Thats all for this one.




    SECOND . . .
    Second, my activecell is located in any column and let's say on row 17 Could be any row. The activecell will always be to the right of column E .

    I need to move the activecell, staying on the same row, to column L - - -

    Thats all for this one.
    __________________

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: How to move to specified column staying on same row

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    Re: How to move to specified column staying on same row

    Hi shg . . .

    Perfect - Works great. The last entry in that column is now found and I am ready for the SECOND STEP . . . SEE BELOW



    SECOND . . .
    Second, my activecell is now located in any column, but for this example it is at L6 .It could be any row. The activecell will always be to the right of column E .

    I need to move the activecell from L6, staying on the same row, to column E - - -

    Hope this is clear.

    Thanks again shg

  7. #7
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    Re: How to move to specified column staying on same row

    Hi Pike . . .

    The SECOND code does not work, as it stops on the first column that data is found as it moves left.

    If we could find column a like shg did for finding the bottom, then we could use offset 4 to move to column E.

    I am going to try playing with the code that shg gave me for finding the bottom and see if I can modify.

    Thanks

  8. #8
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    Re: How to move to specified column staying on same row

    Hi shg & Pike . . .

    Well, I tried changing
    Please Login or Register  to view this content.

    without luck. I simply don't know. I would think that there would be something basically like this formula that would move directly to column A on the same row.

    Maybe this example would be simpler.

    The activecell is L16 or N16 or P16 or whatever column
    I need to move to A16
    Then I could use Offset and always move 4 columns back to the right.

    Please remember: I have to stay on row 16

    Also remember that the next time the macro is run, that the row will likely be different.


    In reviewing my program, this should be the last thing needed (hopefully).

    Thanks

  9. #9
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    Re: How to move to specified column staying on same row

    Hi Again . . .

    Success !.

    Went back to some old code and found the following code that works perfect.

    Please Login or Register  to view this content.
    The first row of code goes to column A on the same row.
    The second row of code takes me back to column E on the same row.

    Thanks Guys

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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