+ Reply to Thread
Results 1 to 6 of 6

Macro for dropdown list in Excel

  1. #1
    Registered User
    Join Date
    04-28-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    3

    Macro for dropdown list in Excel

    Hello,

    Could somebody give me a macro for copying a particular value from a dropdown list into a next column.

    For example:

    If I select "1" (from the dropdown list) then paste "1" to next column(same row)
    If I select "2" (from the dropdown list) paste "2" to next column(same row) on deleting the previously selected option (i.e, "1")

    Please help me in writing this Macro.
    Thanks

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Macro for dropdown list in Excel

    why do you need to do this?. it seems a fairly pointless excercise.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Macro for dropdown list in Excel

    I assume you're using a Data Validation drop-down list? If so, and that is in cell A1, then in B1 simply put =A1

    Whenever you change A1, B1 will be updated.

  4. #4
    Registered User
    Join Date
    04-28-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    3

    Question Re: Macro for dropdown list in Excel

    Thanks a lot pjoaquin. It helped me!!

    I have another issue with the same sheet.
    My dropdown list contains the options like "1,2,3,4,5,6,7, Invalid" (say cell B4)

    "Invalid" is also one of the option.

    1.If the user select numbers 1,2,3,4,5,6,7(from cell B4) that numbers gets copied to next cell say D4.I have implemented this by using "=B4" in D4

    2.If a user selects "Invalid" from the list, user should be able to enter a value (number, character, string, special character) in the corresponding cell next to the dropdown(i.e in D4). how do i implement this?

    Please help me in this .

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Macro for dropdown list in Excel

    now you are explaining yourself it makes a bit of sense. you cant overwrite a formula without changing it so you would need code to do it like that.or perhaps something like this. try the options in the drop down in b4
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-28-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    3

    Thumbs up Re: Macro for dropdown list in Excel

    Hi Martin,

    Thanks a ton
    It really helped....

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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