![]() |
display columns
greetings, i have macro which runs query on database with over 100 columns.
when macro is finished i want to display only those columns i've run the query on, anywhere from two to twenty columns. therefore i hide all the columns of database and have a range which lists each column to display by number (col A =1, col B = 2, etc.) what type of code would i use to display the columns. have used "EntireColumn.Hidden = false" but only seems to work for single column at a time, which would work with a loop. but i'm hoping there's some code that would unhide all the columns at once, any help greatly appreicated. |
display columns
Hi
For instance: Range("A1,C1,F1").EntireColumn.Hidden = True But a small loop is not so inefficient in this case. -- Wigi http://www.wimgielis.be = Excel/VBA, soccer and music "mwam423" wrote: greetings, i have macro which runs query on database with over 100 columns. when macro is finished i want to display only those columns i've run the query on, anywhere from two to twenty columns. therefore i hide all the columns of database and have a range which lists each column to display by number (col A =1, col B = 2, etc.) what type of code would i use to display the columns. have used "EntireColumn.Hidden = false" but only seems to work for single column at a time, which would work with a loop. but i'm hoping there's some code that would unhide all the columns at once, any help greatly appreicated. |
display columns
There are many ways to address ranges, but the following code may give you a
start. Dim R As Range With Worksheets("Sheet1") Set R = .Range("A1, C1, E1") R.EntireColumn.Hidden = True ' OR Set R = Application.Union( _ .Cells(1, 1), .Cells(1, 3), .Cells(1, 5)) R.EntireColumn.Hidden = True End With -- Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) "mwam423" wrote in message ... greetings, i have macro which runs query on database with over 100 columns. when macro is finished i want to display only those columns i've run the query on, anywhere from two to twenty columns. therefore i hide all the columns of database and have a range which lists each column to display by number (col A =1, col B = 2, etc.) what type of code would i use to display the columns. have used "EntireColumn.Hidden = false" but only seems to work for single column at a time, which would work with a loop. but i'm hoping there's some code that would unhide all the columns at once, any help greatly appreicated. |
display columns
hi wigi and chip, i was hoping there was a way i could use the column numbers
en masse. yes, am using a loop and that works fine as the query rarely needs to display more than twenty columns. appreciate the responses! |
All times are GMT +1. The time now is 05:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com