Hide a dynamic table range in macro

beca

New Member
Joined
May 17, 2011
Messages
44
Hi there

I am trying to write a macro to hide a dynamic table range, my code is as below:

Sub Hide()
Range("PART2").Select
Selection.Hidden = True
End Sub

This code doesn't work, can someone tell me what is wrong with the code? and please tell me how to hide dynamic table range in macro.

Thank you very much.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi beca,

You'll need to hide the range's Rows and/or Columns separately.

Code:
Sub Hide_Rows()
    Range("PART2").EntireRow.Hidden = True
End Sub

Sub Hide_Columns()
    Range("PART2").EntireColumn.Hidden = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,607
Messages
6,179,871
Members
452,948
Latest member
UsmanAli786

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