How can I hide a table in Excel 2007 using VBA? I'm looking for a way to turn them off and on programatically.
How can I hide a table in Excel 2007 using VBA? I'm looking for a way to turn them off and on programatically.
Do you mean hide the rows or columns that contain the table, or something else?
Entia non sunt multiplicanda sine necessitate
You can try with:
Should work if your table name is Table1, change that according to your needs otherwise.![]()
ActiveSheet.ListObjects("Table1").Hide
I hoop that works.
.?*??)
`?.???.?*??)?.?*?)
(?.?? (?.?Pichingualas <---
??????????????????????????
Wrap your code with CODE TAGS.
Thank those who helped you, Don't forget to add to their REPUTATION!!! (click on the star below their post).
Please mark your threads as [SOLVED] when they are (Thread Tools->Mark thread as Solved).
It might, if the ListObject object had a Hide method, but it doesn't.
Yeah I noticed lol :P
Maybe like so?
![]()
Range("Table1[[#Headers],[Zone Code]:[Channel]]").Select ActiveSheet.HideSelection = True
How well did that work when you tested it?
Hmm... lol
Maybe this then:
![]()
Range("Table1[#All]").Select Selection.EntireColumn.Hidden = True
Although that wouldnt hide only the table but all the columns lol
The way I see it, it's impossible to hide only the table. You need to hide either its rows or its columns.
@shg: is this correct?
Yup .
Thought so lol
Thanks :P
Thanks guys. So even though it's not possible to completely hide the table using VBA, is it possible to move it?
try this code
check the name of your tableActiveSheet.ListObjects("Table1").Range.Cut Destination:=Range("a11")
Regards
tom1977
If You are satisfied with my solution click the small star icon on the left to say thanks.
Sure. Record a macro of cutting and pasting it.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks