+ Reply to Thread
Results 1 to 6 of 6

Edit VBA code for long list

  1. #1
    Forum Contributor
    Join Date
    08-16-2009
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    109

    Edit VBA code for long list

    Hi,

    I have some exitsing VBA code from an old spreadsheet and had these instructions below to edit where the code worked to add the code to 3 more cells, does anyone know the code that I could use to make this work on multiples cells and starting from c10 down to c200.


    This info below allows me to add to a few cells:-

    Q: In the VBA code, the functionality is for cell C2 only. How do I get it for other cells?

    Ans: To get this multiple selection drop-down in other cells, you need to modify the VBA code in the backend. Suppose you want to get this for C2, C3, and C4, you need to replace the following line in the code:

    If Target.Address = "$C$2" Then

    with this line:

    If Target.Address = "$C$2" Or Target.Address = "$C$3" Or Target.Address = "$C$4" Then


    Regards
    Garry

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Edit VBA code for long list

    Hi Garry,
    Without a clear 'picture' and what it does all answers will be assumptions and you know what I Assume means (makes an *** out of U and Me)
    You say you have code, so I suggest you attach a sample file with dummy daya and explain it there again.
    Will make it easier to grasp and helping much simpler.

    the *** stand for the letters A and two S
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Edit VBA code for long list

    If I read correctly, you want to have the code work for C10 to C200? Not having the rest of the code I don't know if other changes are needed but the If statement would be:

    Please Login or Register  to view this content.
    Just a guess, as Keebellah pointed out, it may be I'm making an *** out of myself
    Last edited by Arkadi; 07-26-2019 at 10:05 AM.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  4. #4
    Forum Contributor
    Join Date
    08-16-2009
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Edit VBA code for long list

    HI,

    Sincere apologises, I should have included a test file.

    I am trying to edit this file so that I can have multiple selections from a drop down list but only work on a range of cells say C10:C200.

    Garry

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Edit VBA code for long list

    In the example you start with row 2, but in your description you want to start at C10... either way the red range in the code below is the affected area:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    08-16-2009
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Edit VBA code for long list

    Many thanks, this now works, much appreciated.
    Garry

+ 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. [SOLVED] How to use edit (code) if the file is from the list box? i used tag but is not working..
    By Chandria in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2019, 09:38 AM
  2. Vba code to vlookup the long list in excel
    By anuwers in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-22-2017, 03:13 PM
  3. [SOLVED] edit code for list box only have data
    By mazan2010 in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 07-12-2017, 12:27 PM
  4. edit in code for populate range of cell in list box and code for delete any items
    By mazan2010 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2017, 03:33 PM
  5. Vba code to edit data that changes with a list box
    By grimston in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-08-2017, 07:59 AM
  6. import long list in custom sort edit
    By RAYSTORRY in forum Excel General
    Replies: 9
    Last Post: 09-14-2015, 05:32 AM
  7. Replies: 4
    Last Post: 09-22-2012, 04:21 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