show table based on dropdown cell value

jega82ster

New Member
Joined
Aug 8, 2016
Messages
1
Hi,

i am a beginner in excel. i have 3 different table (example : Table A, Table B & Table c). I want to show table based on drop down cell value (1, 2 & 3). If i select 1 from drop down list, excel should show Table A, if i select 2 from drop down list, excel should show Table B.

Hope someone can help me on this. Thank you
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
On the assumption your tables are shown with underscore i.e. Table_A ,Table_B, Table_C , and the tables are in different rows and your Validation list is in "A1!", then try this:-

To load code ,Right click sheet Tab, Select "View Code", vbwindow appears, Paste code into Vbwindow, Close Window.
To run code change Selection in cell "A1".
Code:
[COLOR="Navy"]Sub[/COLOR] MG25Feb26
Private [COLOR="Navy"]Sub[/COLOR] Worksheet_Change(ByVal Target [COLOR="Navy"]As[/COLOR] Range)
[COLOR="Navy"]Dim[/COLOR] n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]If[/COLOR] Target.Address(0, 0) = "A1" [COLOR="Navy"]Then[/COLOR]
[COLOR="Navy"]For[/COLOR] n = 65 To 67
    [COLOR="Navy"]If[/COLOR] "Table_" & Chr(n) = "Table_" & Chr(Target.Value + 64) [COLOR="Navy"]Then[/COLOR]
        ActiveSheet.ListObjects("Table_" & Chr(n)).Range.EntireRow.Hidden = False
    [COLOR="Navy"]Else[/COLOR]
        ActiveSheet.ListObjects("Table_" & Chr(n)).Range.EntireRow.Hidden = True
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] n
[COLOR="Navy"]End[/COLOR] If

[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,202,987
Messages
6,052,936
Members
444,616
Latest member
novit19089

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