Results 1 to 6 of 6

Need a macro to loop through a drop down box

Threaded View

WC_500 Need a macro to loop through... 07-12-2011, 06:46 PM
JBeaucaire Re: Need a macro to loop... 07-12-2011, 09:51 PM
WC_500 Re: Need a macro to loop... 07-13-2011, 10:08 AM
JBeaucaire Re: Need a macro to loop... 07-13-2011, 10:33 AM
WC_500 Re: Need a macro to loop... 07-13-2011, 11:04 AM
JBeaucaire Re: Need a macro to loop... 07-13-2011, 08:14 PM
  1. #1
    Registered User
    Join Date
    07-12-2011
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2010
    Posts
    3

    Need a macro to loop through a drop down box

    Hello, I'm new to progamming as you'll probably be able to notice with my code so please bear with me.

    I am trying to use a macro to run a pricing comparison and to copy each price over to another worksheet so I can view all of them in one spot.

    There are 2 companies, A and P, where company P has 14 possible rates depending on what selection is made in cell F23 on the 'Quote' Tab. I set up a macro to move the chosen coverages along with company A premium to the 'Comparison' Tab but am having problems when it comes to quoting and recording all of company P's premiums.

    I set up a macro to loop, which it seems to do, but what I want the macro to do is to start with the first item in the drop down box, A1, (which as an FYI this cell uses the list from AD7:AD20), move company P's rates over to the 'Comparison' Tab and drop them into the corresponding cells in column E. Then go back and change the drop down box to B1, move those rates to column F in the 'Comparison' Tab and so on - all the way to the final selection of Y1 in column R.

    Here is the macro and part of my copy/paste code (which is probably the long way of doing it) that I set up to move company P's premiums over. Does anyone have any insight as to how I can add code to loop through the drop down box and record each of the specific premiums at the same time?

    Dim Quoter As Worksheet
    Set Quoter = Worksheets("Quote")
    Dim Comparisons As Worksheet
    Set Comparisons = Worksheets("Comparisons")
    
        Dim cell As Range
        Set rng = Quoter.Range("AD7:AD20")
        For Each cell In rng.Cells
        Quoter.Range("F23").Value = cell.Value
        Next cell
    
        Quoter.Select
        Range("Q7").Select
        Selection.Copy
        Comparisons.Select
        Range("E17").Select
        Selection.PasteSpecial Paste:=xlPasteValues
        Range("E18").Select
        ActiveCell.FormulaR1C1 = "Included"
        Quoter.Select
        Range("Q11:Q13").Select
        Selection.Copy
        Comparisons.Select
        Range("E20").Select
        Selection.PasteSpecial Paste:=xlPasteValues
    (I attached a spreadsheet with all the code if it helps. The loop code is under Module 2, named Tier A1 macro)
    Attached Files Attached Files
    Last edited by WC_500; 07-13-2011 at 12:12 PM.

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