+ Reply to Thread
Results 1 to 6 of 6

Help with VBA stuff. Range list causing "skip" in cursor to end of cell range

  1. #1
    Registered User
    Join Date
    01-09-2020
    Location
    Canada
    MS-Off Ver
    Excel Version 1912 (Build 12325.20344 Microsoft Store)
    Posts
    36

    Question Help with VBA stuff. Range list causing "skip" in cursor to end of cell range

    Hi All,

    Not sure if I'm in the right spot or not and I'm not too familiar with Excel VBA Stuff (self taught) but created a worksheet where I can "hide/show" rows based on a Yes/No Dropdown list that I have entered in a cell. I have this set up for 7 different areas on Sheet1. The locations are all over the place, one is in J4, one in J21, one in F60 etc as an example. All works just fine however, when I select any of the dropdowns that are part of the cell range in the code the cursor "skips" to the last cell that I have listed in the Range I have in my VBA code. IE: Code is as follows. Set KeyCells = Range("J4,J21,J31,J40,J53,F60,F68"), again all works well, but when I select Cell J4 the cursor moves down to the last cell in my range (F68), if I then scroll back up to J21 and select it, it then too moves the cursor back to F68 and I have to scroll back up to the area of the page I want to work on and so on...
    Hope that makes sense.

    What I need help with is finding a way to have the cursor NOT go to F68 each time I select a cell in the range. Ideally I would love it to move it to a specific cell but even if it just "moves to the next active cell" that would be better than what is happening right now.

    Any insights would be appreciated. Thanks.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Help with VBA stuff. Range list causing "skip" in cursor to end of cell range

    You're in the right spot.

    Can you post your code? Please take note of my signature block below about surrounding your code with CODE tags. It's a forum rule.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    01-09-2020
    Location
    Canada
    MS-Off Ver
    Excel Version 1912 (Build 12325.20344 Microsoft Store)
    Posts
    36

    Re: Help with VBA stuff. Range list causing "skip" in cursor to end of cell range

    Thanks for the quick response AlphaFrog. Appreciate it.

    Here is the code (hopefully I added it correctly, it's a bit of a long one, probably a shorter way to do it but it "works" so to speak). Thanks again.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Help with VBA stuff. Range list causing "skip" in cursor to end of cell range

    As a quick answer (NOT tested ), I will suggest to change your IFs with next code, avoid Selection

    Old
    Please Login or Register  to view this content.
    New
    Please Login or Register  to view this content.
    Last edited by PCI; 01-10-2020 at 09:56 AM. Reason: Typo
    - Battle without fear gives no glory - Just try

  5. #5
    Registered User
    Join Date
    01-09-2020
    Location
    Canada
    MS-Off Ver
    Excel Version 1912 (Build 12325.20344 Microsoft Store)
    Posts
    36

    Re: Help with VBA stuff. Range list causing "skip" in cursor to end of cell range

    Perfect, thanks PCI, that worked.

    Appreciate it.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Help with VBA stuff. Range list causing "skip" in cursor to end of cell range

    Here's your code shortened.

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 01-10-2020 at 09:03 PM.

+ 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] This line of code is causing an error message "Autofilter method of range class failed"
    By hadleedog in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-04-2018, 03:58 AM
  2. VBA - Excel 2013 - WorksheetFunction.CountBlank
    By dude6571 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2017, 05:33 PM
  3. [SOLVED] Calculating a percentage of "Y" and "N" in dynamic cell range
    By InkyDrinky in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-30-2016, 01:35 PM
  4. if Range("A1") = "Mike" Then Range("A1") = "michael" Then Exit Sub
    By a8015945 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-30-2013, 10:08 AM
  5. reference date above last cell in range displaying "1" or "2"
    By leeroyrooney in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-20-2013, 05:41 PM
  6. [SOLVED] Find expression causing "Subscript out of range" error
    By aseret in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-08-2013, 12:05 AM
  7. [SOLVED] While Using Value from Range D3:D in String, if (D, x) = "" doesnt skip to next row??
    By Spyderz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-28-2012, 01:59 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