+ Reply to Thread
Results 1 to 10 of 10

Move down next visible cell

  1. #1
    Registered User
    Join Date
    02-19-2013
    Location
    Sri Lanka
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    71

    Move down next visible cell

    Hi Guys,

    Please can you help me to solve my below macro problem.

    I am writing a small macro.

    I filtered some Value through macro.

    for example A1 is visible but for example A2:A50 is hidden. Next visible row after A1 is A51. I want to select A51 through macro.

    Please give a solution

    Thanks

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

    Re: Move down next visible cell

    Hi, janagan,

    build a range based on the visible cells only and loop through that with a For Each ... Next loop:
    Please Login or Register  to view this content.
    No need to activate or select a cell.

    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

  3. #3
    Registered User
    Join Date
    02-19-2013
    Location
    Sri Lanka
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    71

    Re: Move down next visible cell

    hi Friend,
    Thanks for your response. But this is not what i expect.

    If I write Range("A1").offset(1,0).select, it select A2 cell. Nut I want next visible cell after filter. For example if A43 is a next visible cell... i want to select that cell only. please try for me..

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

    Re: Move down next visible cell

    Hi, janagan,

    maybe we could just analyse the line of code that you insist to use (although it will never do what you expecz oit to do).
    Please Login or Register  to view this content.
    You go to Range("A1") and want to offset 1 Row and 0 Column which makes it A2 - why are you surprised that your code does what the code is supposed to do? Even if you put in SpecialcCells there you would end up with that cell selected.

    Maybe you should ask yourself why you would need to drag the cursor around instead of working with objects which do what you want? I supplied a working code which loops through the visible cells only - still no need for any Select/Activate.

    Ciao,
    Holger

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

    Re: Move down next visible cell

    Hi, janagan,

    Iīm still not convinced by using Select/Activate but maybe this comes in to what you expect - you would need to activate the cell prior to the one you want selected as the next one (not what I would call solid coding):
    Please Login or Register  to view this content.
    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    02-19-2013
    Location
    Sri Lanka
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    71

    Re: Move down next visible cell

    Hi Holger,

    Thanks for the reply. Here i attached sample file. Please check and let me know.

    It is a sample file. Original file i can't take a copy. And in my company there is no access for external mailing. I am writing this mail from home. In my sheet, i just type 7 to 8 records. But Actually there are 15000 rows of records. So manual adjustment is very difficult for me. please give a solution

    Thanks.
    JanaganSample.xlsm

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

    Re: Move down next visible cell

    Hi, janagan,

    So manual adjustment is very difficult for me. please give a solution
    There are no hidden rows in your sample file which makes a solution simple (use Offset in your sample), and there still is no explanation why you would need to activate the next visible cell.

    Ciao,
    Holger

  8. #8
    Registered User
    Join Date
    02-19-2013
    Location
    Sri Lanka
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    71

    Re: Move down next visible cell

    Hi Holger,

    But when i filter there are some rows are hidden. right? Am i right?

    If my thought is wrong, please can u correct the coding please.. Thanks

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

    Re: Move down next visible cell

    Hi, janagan,

    I hope your functions will write to a different cell than they refer to - itīs the very same code I posted in my first answer except that it doesnīt display the Address of the cells but calls functions which you donīt show:
    Please Login or Register  to view this content.
    I have a slight problem understanding why the same range would be needed to call two different functions.

    Ciao,
    Holger

  10. #10
    Registered User
    Join Date
    02-19-2013
    Location
    Sri Lanka
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    71

    Re: Move down next visible cell

    Thank you very much Holger.

    It work perfectly.

    I need two function because. Vendor Name and Employee Name extraction method just different criteria. Thanks a lot Holger....

+ 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. [SOLVED] vba to move to next visible sheet
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-01-2012, 01:21 AM
  2. Move to the next visible row within column
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-24-2012, 10:17 AM
  3. Need to move to the next visible row in VBA
    By Iswarya in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-22-2010, 03:15 PM
  4. Macro to Move Visible Cells after Subtotaling
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-14-2008, 05:08 PM
  5. Need macro to move down & select next visible row
    By Fartnuckles in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2006, 10:02 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