Open Close Columns

  • Thread starter Thread starter Steved
  • Start date Start date
S

Steved

Hello from Steved

I email a worksheet to others in the company.
How would I go about Open Columns then Close Columns
I know I can build a macro to open Columns, and using a
Command Button on the worksheet, the problem my issue is
how to I write the formula so that wiil close the colums.

The colums I want to open are D and E, G and H, J and K,
M and N, P and Q, S and T, V and W, Y and Z, AB and AC
and Then Close. (The reason unopened you can print on A4)

So in Col C I have Data and D is a number E is the average
of D and C.
Example 12 vehicle travelled a total of 12,575 Kilometres
what is the average travelled by each vehicle.

Thankyou.
 
Hello from Steved

Used the below formula which works perfect.
Cheers


Private Sub CheckBox1_Click()
Dim r As Range
Set r = Range
("D1:E1,G1:H1,J1:K1,M1:N1,P1:Q1,S1:T1,V1:W1,AB1:AC1")
r.EntireColumn.Hidden = Not r.EntireColumn.Hidden
End Sub
 
Back
Top