Macros not triggered after drop down list selection

abstracto

New Member
Joined
Jan 11, 2023
Messages
6
Hello everyone

Glad to join the forum!

I have an issue with macros in an excel file I'm working on. I attached worsheet screen shots for reference.
Sheet 'calculation has all the formulas'. Sheet ' drop down list info' has info for drop down lists (2 used in the main sheet).

There's a drop down list in the cell D6 that has 3 options: SEA, AIR and SEA+AIR.

I created 3 macros that should be triggered based on option selection from above mentioned drop down list.

SEA and AIR macro basically just hides selected rows. SEA+AIR macro unhides all. Each macro also goes back to cell D6 at the end.

However it doesn't seem to work at all. I have checked several forums but couldn't find a solution to my problem.

If I run macros manually everything works well.

Please advise what kind of mistake I did. I must say that I have completely no idea about VB and all the cose used in macros comes from recording macros step by step and then adjusting it a bit based on what I found online.

Thanks in advance for your kind help!

Macros code below:


VBA Code:
Sub SEA()
'
' SEA Macro
'

'
    Rows("14:20").Select
    Selection.EntireRow.Hidden = True
    Rows("7:13").Select
    Selection.EntireRow.Hidden = False
    Range("D6").Select
    
End Sub

Sub AIR()
'
' AIR Macro
'

'
    Rows("7:13").Select
    Selection.EntireRow.Hidden = True
    Rows("14:20").Select
    Selection.EntireRow.Hidden = False
    Range("D6").Select

End Sub
 
Sub BOTH()
'
' BOTH Macro
'

'
    Sheet.Select
    Selection.Sheet.Hidden = False
    Range("D6").Select

End Sub
 

Attachments

  • calculation sheet.png
    calculation sheet.png
    139.7 KB · Views: 27
  • drop down list info sheet.png
    drop down list info sheet.png
    107.6 KB · Views: 29
Thanks mate!

Everything is working now. Really appreciate your help here. I'll try more and more on my own.

Have a great day!
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Thanks for the positive feedback(y), glad having been of some help.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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