+ Reply to Thread
Results 1 to 8 of 8

Get Selected Value from Data Validation List

  1. #1
    Registered User
    Join Date
    05-23-2018
    Location
    Durham, NC
    MS-Off Ver
    2013
    Posts
    5

    Get Selected Value from Data Validation List

    I have an Excel file with a significant amount of data in it. Every so often (about every other month) one of the guys in the group develops a newer version of the Excel file with more options in it, and more data. When this happens, currently all of the users of his Excel file go and (by hand) pull the data from the old version and copy/move/retype it into the newer version. I want to automate this. I've made a bit of headway but when I got to cells that are picked via Data Validation Drop Downs, the copy throws and error something like: "The name "Race" already exists. Click Yes to use that version of the name, or click No to rename the version "Race" you're moving or copying."
    So I went back and tried to get the data from those cells individually (I was copying via Range.copy of cells). I expected to be able to use something like Range("K15").Value to get the value, but I get an error message that isn't very helpful.

    Here's the code I'm working with currently:
    Please Login or Register  to view this content.
    I'm also open to suggestions to simplify or compact my code.

    Thanks!!

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Get Selected Value from Data Validation List

    If you copy and then Pastespecial xlPasteValues, you will get the data only. The validations, formats, formulas, etc. in the sheet being copied into should not change.

    If you need more help, include a sample workbook.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    05-23-2018
    Location
    Durham, NC
    MS-Off Ver
    2013
    Posts
    5

    Re: Get Selected Value from Data Validation List

    Thanks.

    So I've been using a .Copy command. I'll look into a xlPasteValues, that might solve the problem.
    If it doesn't, I can attach the entire file. There's nothing in there that's private/secret/confidential.
    Last edited by McArgent; 05-24-2018 at 04:06 PM.

  4. #4
    Registered User
    Join Date
    05-23-2018
    Location
    Durham, NC
    MS-Off Ver
    2013
    Posts
    5

    Re: Get Selected Value from Data Validation List

    Okay, the .PasteSpecial xlPasteValues worked, until I try to paste into cells that are merged. Is there a trick to get around that?

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Get Selected Value from Data Validation List

    Merged cells are a bad idea. It's OK to use merged cells as titles but not as column headers or to hold data. There are some exceptions, but none of them involve copy / paste.

    First idea: Use Center Across Selection instead of merged cells. The results look the same. The unfortunate thing is Center Across Selection is buried in the Alignment Tab of Format Cells whereas Merge and Center is staring you in the face on the Home Ribbon. Microsoft should put Center Across Selection in the number one spot on that menu.

    Second idea: merge the cells in what you are copying the same way they are merged to what you are copying to.

    Third idea: un-merge all cells and then re-merge what you have to.

    i think you are beginning to see why people who played with Excel for a while avoid merged cells when they can.

  6. #6
    Registered User
    Join Date
    05-23-2018
    Location
    Durham, NC
    MS-Off Ver
    2013
    Posts
    5

    Re: Get Selected Value from Data Validation List

    The merge-across vs merged cells didn't help. I typically use Merge Across, so I wasn't surprised that I still had here.
    Copying the merge-format of the to and from cells fixed the problem.

    Thanks again!!

  7. #7
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Get Selected Value from Data Validation List

    Don't use Merge Across.

    Unmerge the cells. Highlight the range you want it to center on.

    Right click it and select Format Cells to bring up the Format cells dialog box.

    Click on the alignment tab. Under Horizontal, use the drop-down to select Center Across Selection.

  8. #8
    Registered User
    Join Date
    05-23-2018
    Location
    Durham, NC
    MS-Off Ver
    2013
    Posts
    5

    Re: Get Selected Value from Data Validation List

    I'll look into this. Does it merge the cells? I can't leave the cells unmerged or the data in them would become illegible.

+ 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. Replies: 4
    Last Post: 07-03-2014, 02:37 AM
  2. How can I get the selected value of a data validation list with vba?
    By nikko50 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2014, 04:29 PM
  3. Data Validation list. Each selected option gives different score
    By jaywizz in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-15-2013, 11:57 AM
  4. Updating cells when a different name in a Data Validation list is selected
    By movali01 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-14-2012, 10:02 AM
  5. Password for Data Validation selected List
    By hecgroups in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-30-2012, 02:16 AM
  6. data selected by validation 2 list
    By pichai in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-23-2008, 08:39 AM
  7. data validation list selected from a range
    By Native in forum Excel General
    Replies: 11
    Last Post: 01-19-2006, 09:15 PM
  8. how to monitor the selected value of a Data Validation list
    By silkworm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2005, 12:10 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