+ Reply to Thread
Results 1 to 4 of 4

Value in a merged cell with a range name

  1. #1
    Registered User
    Join Date
    04-11-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Question Value in a merged cell with a range name

    I have a spreadsheet with a spinner button which increases/decreases the value of a certain cell. The cell is actually a two cells merged into one, and has a name associated with it (a named range). When I press another control button on the sheet, I want the control button's VBA routine to read this named range's value and respond to it accordingly, but I'm not sure how to read the value from the spreadsheet.

    If the cell's name (range name) is 'bmNumber', how can I read the value and store it in a VBA variable for later use?

    Please Login or Register  to view this content.
    The above code doesn't want to work for me. I'm guessing it has something to do with the fact that the value is actually from two cells that are merged. Do I need to somehow separate/unmerge the cell before reading a value?

    What am I doing incorrectly?

  2. #2
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Value in a merged cell with a range name

    Welcome to the forum! Is the name associated with the first cell in the merged range? If not, the value will not be returned as you desire.
    Bob
    Click my star if my answer helped you. Mark the thread as [SOLVED] if it has been.

  3. #3
    Registered User
    Join Date
    04-11-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Value in a merged cell with a range name

    Thanks for the reply and welcome.

    The name is associated with the cell formed by the two merged cells.
    Would the only way to do this correctly be to name one of the two cells 'bmNumber', merge this cell with the other (unnammed) cell, assign the newly formed (merged) cell a value, and then use 'bmNumber.Value' to retrieve the value?

  4. #4
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Value in a merged cell with a range name

    For example, if the cells C1:D1 are merged, the name should be associated with C1, not D1, or C1:D1.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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