+ Reply to Thread
Results 1 to 8 of 8

RefEdit and choosing cells that aren't adjacent

  1. #1
    Registered User
    Join Date
    12-02-2017
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    55

    RefEdit and choosing cells that aren't adjacent

    Hello there.

    I'm making a macro with a userform with several RefEdits. It's easy enough to let the RefEdit choose several adjacent cells (fx: E10, E11 and E12), but I don't know how to make it work with non-adjacent cells (fx: E10, E14 and E18).

    The relevant code is this:

    Please Login or Register  to view this content.
    Above code works perfectly if I choose E10, E11 and E12, but not E10, E14 and E18.

    Anyone has a solution to this?

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: RefEdit and choosing cells that aren't adjacent

    Did you try pressing Ctrl-key while selecting cells ?
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    12-02-2017
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    55

    Re: RefEdit and choosing cells that aren't adjacent

    Quote Originally Posted by bakerman2 View Post
    Did you try pressing Ctrl-key while selecting cells ?
    Yes. I get to choose the different cells. It just doesn't work in the formula.

  4. #4
    Registered User
    Join Date
    12-02-2017
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    55

    Re: RefEdit and choosing cells that aren't adjacent

    I get the error:


    PHP Code: 
    Run-time error '1004':

    Method 'Range' of object '_Global' failed 

    Then highlights:

    Please Login or Register  to view this content.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: RefEdit and choosing cells that aren't adjacent

    How about this.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-02-2017
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    55

    Re: RefEdit and choosing cells that aren't adjacent

    Quote Originally Posted by bakerman2 View Post
    How about this.

    Please Login or Register  to view this content.
    This worked! Except I had to change the =average to =middel (native language). So my macro will only work in Danish Excel, I guess?

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: RefEdit and choosing cells that aren't adjacent

    This should translate correctly.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-02-2017
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    55

    Re: RefEdit and choosing cells that aren't adjacent

    Quote Originally Posted by bakerman2 View Post
    This should translate correctly.

    Please Login or Register  to view this content.
    This worked. 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. Copy values from adjacent cells to groups of adjacent cells with gaps
    By Kneigum in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-08-2017, 04:50 PM
  2. [SOLVED] highlight duplicate values in their own row even if values aren't adjacent
    By terryhenderson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2016, 01:20 PM
  3. Count Cells that aren't #N/A
    By Bobbydubz in forum Excel General
    Replies: 2
    Last Post: 04-13-2012, 08:20 PM
  4. Cells aren't properly aligned
    By fusionman in forum Excel General
    Replies: 3
    Last Post: 08-05-2008, 04:12 PM
  5. Summing only those cells that aren't hidden
    By JodyK in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-13-2005, 02:05 PM
  6. COUNT ONLY CELLS THAT AREN'T BLANK
    By paulinec in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-07-2005, 10:06 PM
  7. [SOLVED] COUNT ONLY CELLS THAT AREN'T BLANK
    By paulinec in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-07-2005, 07:06 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