ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   filter by column instead of rows (https://www.excelbanter.com/excel-programming/396779-filter-column-instead-rows.html)

[email protected]

filter by column instead of rows
 
I have a sheet with many columns in it and I want to hide columns by
checking the top cell in every row for a specific string.

I am currently using a for loop to check every cell for a combination
of two letters using InStr and hiding the column if it does not
contain the string that I want.

This method works but is pretty slow when I have nearly 200 columns to
check. Is there a faster way to filter by row? The built in auto
filter by columns is much faster even when there are 300+ rows.

Thanks,
David


[email protected][_2_]

filter by column instead of rows
 
When you hide the rows hide them 20 at a time instead of one and at a
time and that will speed things up.


[email protected]

filter by column instead of rows
 
How would I hide multiple columns at a time? would I use
range("myrange").EntireColumn.Hidden = True?

Thanks,
David

On Sep 2, 7:57 pm, "
wrote:
When you hide the rows hide them 20 at a time instead of one and at a
time and that will speed things up.




[email protected][_2_]

filter by column instead of rows
 
Yeah.

Sub b()
Dim b As Workbook
Dim s As Worksheet
Set b = ThisWorkbook
Set s = b.Sheets("Sheet1")
s.Range("A:A,D:D").EntireColumn.Hidden = True
End Sub



All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com