View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Derk Derk is offline
external usenet poster
 
Posts: 2
Default Macro to Set width of cells

Made a bit if a mess of explainin my problem, I'll try again

I have 31 colums B2 to AF2, which contain dates (01/01/2005, 02/01/2005,
etc). I wish to hide cols that refer to Saturday or Sunday. I undertand the
code below, but the line Colums("B:B").Columnwidth=0 needs to relate to each
column

Thanks


"arunkhemlai" wrote in message
...
' ======================
Option Explicit

Sub Check()
Dim rng, c

Set rng = Range("B3:B34")
For Each c In rng
If c = "Sat" Then
Columns("B:B").ColumnWidth = 0
End If
Next
End Sub
' ======================

Goodluck -- arunkhemlai


"Derk" wrote:

I have a sheet with days of the week in the heading, for a month. I

would
like to hide the col if it is a Saturday or Sunday. I am working on

trying
to write a macro to check the value of B3 to B34 (which contains the

date
and see if it contains Sat or Sun and then set the col width to zero.

Thats
the theory, but am stuck with the code required to get the check each

cell
then set the width

Thamnks


Derrick