+ Reply to Thread
Results 1 to 6 of 6

Help to Multi Range Code in Sheets(1)

  1. #1
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Help to Multi Range Code in Sheets(1)

    Hi Forum.

    There is a description on the problem in the attached, when opening.
    But I'll describe my problem here too.
    ---------------------------------

    Depending of the selected area, the cells will On Focus change to yellow and change back Off Focus.
    And it's only in the selected area.

    My problem is in the code in Sheets(1) = Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    The range in my real worksheet is far to big and makes a BUG.
    The code runs, if I only use 2/3 of the range.

    Below in this Sheets(1), is a copy of the code from my real Worksheet.
    And in this code I had tried to set up a Multi Range, to split up the Range-codes.

    There is a REM-line in both the Small area and the Big area.
    The REM-line is the original Range-code, which makes the BUG.

    Just below the two REM-lines is the codes I had tried to set up.
    They should define Range r1-r2 and r3-r4.

    But I can't figure out, how to make the codes.
    I hope to get some help.

    Kind regards
    Ib
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    06-29-2011
    Location
    Fort Lauderdale
    MS-Off Ver
    Excel 2018
    Posts
    24

    Re: Help to Multi Range Code in Sheets(1)

    I only see "Ark1" worksheet, I don't see the "Forside" sheet; is that the problem or you just deleted Foreside trying to keep your example simple?

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: Help to Multi Range Code in Sheets(1)

    Hi Clockmaker.

    The code with the tab "Forside" is from the workbook I'm working on or my "Real Workbook".
    It was in this code I tried to make the "Multi Range Code".

    To show what I wanted to do I needed to make a "Test workbook", with a "Normal Range Code".
    It's the code with "Ark1" (Sheet1 in Danish).


    This code below should fit this "Test Workbook"
    - "Forside" had been changed to "Ark1".
    - The range in Set r1-r2 and r3-r4 had been split in two to fit the Test Workbook.
    - The REM-line is still the same - Not working because it's to long / contain to many Ranges.

    Just copy the code below into the Private Sub Worksheet_SelectionChange(ByVal Target As Range) and I believe it should fit the "Test Workbook".
    Please Login or Register  to view this content.
    Kind regards
    Ib

    Ps. I had tried to change the Set Code as below.
    It doesn't work either..
    Please Login or Register  to view this content.
    Last edited by gnaske; 01-27-2019 at 04:23 AM.

  4. #4
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: Help to Multi Range Code in Sheets(1)

    I have a fully working "Time Stamp Code" with a "Multi Range Code", in the same Workbook .
    It was this "Multi Range" I tried to duplicate to the "Color Code".

    If I use the "Time Stamp, Multi Range" together with the "Color, Normal Range" it works.
    But trying to duplicate the "Multi Range" into the "Color Code" doesn't work.

    This is the working Time Stamp Code.
    Ps. There is a lot of Danish explanation in between the code and as you can see below the Multi Range Code, is the Normal Range Code (REM) as well.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-29-2011
    Location
    Fort Lauderdale
    MS-Off Ver
    Excel 2018
    Posts
    24

    Re: Help to Multi Range Code in Sheets(1)

    This is a lot of code to review and I have a project deadline, so I'm running out of time. If you're able to isolate a smaller example of code that shows how it breaks then it may be easier for the group to help troubleshoot... and also for you to troubleshoot.

    I did find some example code that may be of help. Sorry that I'm running out of time on this.

    Notice how this code used the For EACH command; I've also seen examples that use the .Address method as well. Again, if you can show some smaller code that still breaks then i suspect you will discover your error or at least have something easier to help with.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: Help to Multi Range Code in Sheets(1)

    Hi again Clockmaker.

    I solved the problem, simply instead of trying to make a Multi Range I just split up the range by using AND.
    The code is running as you can see, if you download the attached.
    The attached contain the same Cells and Ranges as my Real Workbook

    Thank you for your help

    Kind regards
    Ib
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by gnaske; 01-27-2019 at 11:52 AM.

+ 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. VBA code: To filter multi values of a PowerPivot from a sheet-range.
    By saudi_red_neck in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-05-2018, 01:45 PM
  2. Formula to sum from multi sheets and criteria range
    By Naveenaggarwal in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-26-2018, 07:56 AM
  3. Copy Multi Rows From Multi Sheets Based On Column Value And Create New Workbooks
    By Huskersippi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2017, 04:51 PM
  4. [SOLVED] Multi-select ListBox Displays Sheets Then Runs Code
    By Shea2288 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-04-2016, 03:50 PM
  5. [SOLVED] Code for Merge Multi Sheets using user input
    By Liz_Biz in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-29-2013, 03:18 PM
  6. [SOLVED] How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook?
    By Dmitry in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-29-2006, 07:50 AM
  7. Replies: 6
    Last Post: 03-29-2006, 07:50 AM

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