Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 519
Default Is there away to shorten

Hello from Steved

Is their away please to shorten the below part off the code thankyou.

("K1:L1,N1:O1,Q1:R1,T1:U1,W1:X1,Z1:AA1,AC1:AD1,AF1 :AG1,AI1:AJ1,AL1:AM1,AO1:AP1")

Private Sub CheckBox1_Click()
Dim r As Range
Set r =
Range("K1:L1,N1:O1,Q1:R1,T1:U1,W1:X1,Z1:AA1,AC1:AD 1,AF1:AG1,AI1:AJ1,AL1:AM1,AO1:AP1")
r.EntireColumn.Hidden = Not r.EntireColumn.Hidden
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Is there away to shorten

This builds the same range. It will take a tiny bit longer to execute, but
who wants to type in all those cell pairs??

Sub SteveD()
Set r = Range("K1:L1")
For i = 14 To 41 Step 3
Set r = Union(r, Range(Cells(1, i), Cells(1, i + 1)))
Next
End Sub
--
Gary''s Student - gsnu200779


"Steved" wrote:

Hello from Steved

Is their away please to shorten the below part off the code thankyou.

("K1:L1,N1:O1,Q1:R1,T1:U1,W1:X1,Z1:AA1,AC1:AD1,AF1 :AG1,AI1:AJ1,AL1:AM1,AO1:AP1")

Private Sub CheckBox1_Click()
Dim r As Range
Set r =
Range("K1:L1,N1:O1,Q1:R1,T1:U1,W1:X1,Z1:AA1,AC1:AD 1,AF1:AG1,AI1:AJ1,AL1:AM1,AO1:AP1")
r.EntireColumn.Hidden = Not r.EntireColumn.Hidden
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 519
Default Is there away to shorten

Thankyou.

"Gary''s Student" wrote:

This builds the same range. It will take a tiny bit longer to execute, but
who wants to type in all those cell pairs??

Sub SteveD()
Set r = Range("K1:L1")
For i = 14 To 41 Step 3
Set r = Union(r, Range(Cells(1, i), Cells(1, i + 1)))
Next
End Sub
--
Gary''s Student - gsnu200779


"Steved" wrote:

Hello from Steved

Is their away please to shorten the below part off the code thankyou.

("K1:L1,N1:O1,Q1:R1,T1:U1,W1:X1,Z1:AA1,AC1:AD1,AF1 :AG1,AI1:AJ1,AL1:AM1,AO1:AP1")

Private Sub CheckBox1_Click()
Dim r As Range
Set r =
Range("K1:L1,N1:O1,Q1:R1,T1:U1,W1:X1,Z1:AA1,AC1:AD 1,AF1:AG1,AI1:AJ1,AL1:AM1,AO1:AP1")
r.EntireColumn.Hidden = Not r.EntireColumn.Hidden
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I shorten this any? Gregory Day Excel Worksheet Functions 1 April 10th 08 06:29 PM
Shorten a formula Jeze77 Excel Discussion (Misc queries) 6 August 30th 07 06:34 PM
Shorten Formula Lemmesee Excel Worksheet Functions 3 January 7th 07 10:30 PM
Any way to shorten this up? Kevin M Excel Worksheet Functions 2 November 6th 06 07:50 PM
Shorten A Name rocket0612 Excel Discussion (Misc queries) 3 June 14th 05 11:37 AM


All times are GMT +1. The time now is 11:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"