Macro to cycle through dropdown, paste output to tab by grouping

PghYoPro

New Member
Joined
Dec 9, 2015
Messages
23
Hello,

Hoping someone can point me towards a solution on the following:

In tab "model", I have a model that outputs data in cells B2:G104. This is based on a dropdown selection in cell I5 that pulls from a list in tab "List by SL", cells B2:478.

Cell I8 in the tab "model" is an index match formula that pulls in the grouping category for the dropdown list type.

I need to automate the next part of the file, based on the following:


  • I'd like to create a tab for each grouping category in cell I8 from tab "model"
  • The macro should cycle through the dropdown in cell I5 in tab "model" and paste output from cells B2:G104 in tab "model" to the applicable grouping category tab
  • Since multiple outputs will be pasted to the same grouping category, it is important they are pasted below the previous output

Any help or guidance is much appreciated - I'm having difficulty linking the pieces together but am continuing to research the steps to create.

Thanks!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
What type of dropdown is it - a data validation in-cell dropdown, a combo box form control, or something else? The code to loop through the dropdown values is dfferent depending on the type.

For example, this loops through data validation values:
Code:
Public Sub Loop_Data_Validation_Values()

    Dim dataValidationCell As Range, dataValidationListSource As Range, cell As Range
    Dim resp As Long
     
    'The data validation cell
    Set dataValidationCell = Worksheets("Model").Range("I2")
     
    'Determine where validation comes from
    Set dataValidationListSource = Evaluate(dataValidationCell.Validation.Formula1)
     
    'Loop through data validation source cells
    For Each cell In dataValidationListSource
        dataValidationCell.Value = cell.Value
        DoEvents
        If resp <> vbYes Then
            resp = MsgBox(dataValidationCell.Address & " = " & dataValidationCell.Value & vbCrLf & vbCrLf & "Continue? Yes - All, No - Next, Cancel - Stop", vbYesNoCancel)
            If resp = vbCancel Then Exit For
        End If
    Next
    
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,438
Members
448,897
Latest member
dukenia71

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top