filter by column instead of rows

  • Thread starter david.j.winfield
  • Start date
D

david.j.winfield

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
 
G

gimme_this_gimme_that

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

david.j.winfield

How would I hide multiple columns at a time? would I use
range("myrange").EntireColumn.Hidden = True?

Thanks,
David
 
G

gimme_this_gimme_that

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top