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
 

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Welcome to the board.

Try

Rows("4:4").SpecialCells(xlCellTypeConstants, 2).EntireColumn.Hidden = True
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
If the intention is to hide columns with TEXT (non numeric and not blank) in Row 4, then that line is ALL you need.
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,508
Messages
5,511,709
Members
408,862
Latest member
sidneybc

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top