+ Reply to Thread
Results 1 to 6 of 6

Apply VBA code to multiple cells

  1. #1
    Registered User
    Join Date
    11-23-2013
    Location
    Oregon
    MS-Off Ver
    Excel Starter 2010
    Posts
    15

    Apply VBA code to multiple cells

    Hi there,

    I'm trying to make a drop-down menu within which multiple answers can be selected. I found some code online that I copy-pasted into my file and it works great, except that it only applies to one cell. I would like to have this multiple-selection enabled dropdown menu for a whole column of cells on my sheet.

    Here is the code:

    Please Login or Register  to view this content.
    ...where I4 is just one of the cells in which I would want this kind of drop-down menu to appear. I have never used VBA before, so the answer may be obvious to others, but my question is: how can I apply this code to cells other than I4?

    Thanks!
    Last edited by alansidman; 10-06-2014 at 02:49 PM. Reason: code tags added

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,696

    Re: Apply VBA code to multiple cells

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Apply VBA code to multiple cells

    Hi,

    Without going into the rest of the code, if you want to use the event procedure for the whole column "I", then try something like this (marked in red):

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-23-2013
    Location
    Oregon
    MS-Off Ver
    Excel Starter 2010
    Posts
    15

    Re: Apply VBA code to multiple cells

    Wow that works great! Thanks!!

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,958

    Re: Apply VBA code to multiple cells

    @rosenina18

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,696

    Re: Apply VBA code to multiple cells

    You're welcome.




    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Apply VBA code to multiple sheets
    By PaulusKabouter in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2013, 11:37 AM
  2. Apply VBA code to multiple cells
    By jond291 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-31-2013, 07:33 AM
  3. [SOLVED] Can i modify this code to apply to multiple checkboxes and sheets?
    By stolen_83 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-14-2013, 02:44 PM
  4. [SOLVED] Match code to apply multiple cells in 1 Sub
    By colvinb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-20-2012, 06:38 AM
  5. Need to apply VBA code to multiple Worksheets
    By parteegolfer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-12-2006, 04:43 PM

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