VBA Hide All Columns with Text

KBartmanovich

New Member
Joined
Aug 6, 2010
Messages
6
I am trying to write a VBA Macro to hide all columns with TEXT in a certain Row.
Background:

I have a spreadsheet, in ROW4 I have Dates and Quarterly totals. The Column names are as such:
"01/01/2008", "01/02/2008", "01/03/2008", "Q1, 2008" and so on.
I am trying to set it up so that all of the columns with the TEXT format ("Q1, 2008") can be hidden.
So far I have:

Dim intColCntr, intLastCol As Integer
Dim intNoColTtl As Integer
intColCntr = 3

Cells.Select
Selection.EntireColumn.Hidden = False

If Application.WorksheetFunction.IsText(Range("A4").Offset(intColCntr + 1) & "4") Then
Range(Columns("A4").Offset(0, intColCntr + 1) & "4").Select
Selection.EntireColumn.Hidden = True
End If

Please help. I am very new to writing VBA, and cannot seem to get this one to work AT ALL!!!

Kathryn
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Welcome to the board.

Try

Rows("4:4").SpecialCells(xlCellTypeConstants, 2).EntireColumn.Hidden = True
 
Upvote 0
If the intention is to hide columns with TEXT (non numeric and not blank) in Row 4, then that line is ALL you need.
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,839
Members
449,051
Latest member
excelquestion515

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