+ Reply to Thread
Results 1 to 15 of 15

Select and Show the Selected Cell, Row or Column

  1. #1
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Select and Show the Selected Cell, Row or Column

    Hello,

    I have a worksheet with a long data which fills the Range("A1:DG4600"). As result, I won't be able to see all this data on one screen unless I zoom out the whole sheet.

    So I ran a macro to lookup matching value (if exists) and take me to that row by selecting it. The issue is that when the macro is executed, the row is selected but it doesn't take me to that selected row, unless the range displayed on my screen is the same range where the selection is.

    What should I do to have the selected row displayed on the screen, in other words, for me to be taken there so I can have a look at it?

    Thank you very much.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,502

    Re: Select and Show the Selected Cell, Row or Column

    Use Application.GoTo
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Select and Show the Selected Cell, Row or Column

    Alternatively use
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: Select and Show the Selected Cell, Row or Column

    Thank you Fluff. I did use this but somehow it superseded the Activate function of the worksheet on a specific cell every time I switch to that worksheet.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Select and Show the Selected Cell, Row or Column

    Sorry, but I don't understand what you are saying.

  6. #6
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: Select and Show the Selected Cell, Row or Column

    Quote Originally Posted by Fluff13 View Post
    Sorry, but I don't understand what you are saying.
    I have the following code on Sheet1. Every time I switch (open) that worksheet, it always go to (select) the last row on the column G. And now, it no longer does it after I used the 'Activate' statement.

    They may not be inter-related but yet, somehow it doesn't work when I use that one. Thank you.

    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Select and Show the Selected Cell, Row or Column

    Do you want the the last cell in col G to be selected,or the row that you found?

  8. #8
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: Select and Show the Selected Cell, Row or Column

    Quote Originally Posted by Fluff13 View Post
    Do you want the the last cell in col G to be selected,or the row that you found?
    Well, it's a bit complex. I would like to have the last Cell in col G to be selected every time I switch to its worksheet. However, when I run a macro, that will lookup for a match from a userform textbox, if it's a match, then I would like to go to that matching row on the data.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,502

    Re: Select and Show the Selected Cell, Row or Column

    Did you see post #2? And, if you did, have you tried it?

  10. #10
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: Select and Show the Selected Cell, Row or Column

    Quote Originally Posted by TMS View Post
    Did you see post #2? And, if you did, have you tried it?
    Hello TMS,

    Thank you for your suggestion. I did but I probably did it incorrectly as my understanding is I have to create a label for it to function. Can you enlighten on where should I have the GoTo statement?

    Thank you.

  11. #11
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Select and Show the Selected Cell, Row or Column

    Please Login or Register  to view this content.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,502

    Re: Select and Show the Selected Cell, Row or Column

    Nigel has given an example. This is Application.GoTo which goes to a cell on the worksheet, not GoTo label which goes to a label elsewhere in the code.

  13. #13
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: Select and Show the Selected Cell, Row or Column

    Hello,
    I used the Application.GoTo as per below (hyphenated now) but it didn't go to that particular cell. Somehow with the .Select, it is working but the issue is if let's say I am in the bottom of my data then I will have to scroll up to where it is selected.
    What other options I may have?

    Please Login or Register  to view this content.

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,502

    Re: Select and Show the Selected Cell, Row or Column

    You need the last parameter to be True

    See: https://docs.microsoft.com/en-us/off...plication.goto

    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: Select and Show the Selected Cell, Row or Column

    I haven't managed to make this work yet but I'm sure it is the correct thing to do. I have kept the
    Please Login or Register  to view this content.
    one for the time being. I think it got something to do with earlier code I used which probably clashes with this GoTo.

    Will update when I found out the culprit. [will keep the post open for the moment]

    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. how to show head of column or row when select any cell in excel
    By mazan2010 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-20-2017, 10:48 AM
  2. Replies: 9
    Last Post: 11-20-2015, 04:20 AM
  3. VBA-Show cell value in column (A) when i select row
    By Ezzathaz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-12-2015, 09:20 AM
  4. Replies: 2
    Last Post: 01-30-2013, 03:16 AM
  5. [SOLVED] Hide show column selected column based on value
    By ola7mat in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-07-2012, 02:44 PM
  6. How to select column to sort by - from selected cell
    By Launchnet in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-27-2011, 01:12 PM
  7. Select a Cell to show the last entry in a column
    By tallpaul in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-17-2007, 03:56 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