Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Range of columns

Hello...
I have that problem (excuse me for my english)..
Why in sheet "me" I can use:

.Range(Columns(15), Columns(17)).Hidden = False

and in another sheets can't I?
I used a For cycle to do it!

For k = 18 To 20
.Columns(k).Hidden = False

Is there another way to hidden a range of columns in another sheets?
How can I hidden that columns(15,16,17 e 21) in another sheets wit
only row of code?
Thanks
Francesco

ToggleButton3.Caption = "Nascondi Previsioni"
With Me
.Range(Columns(15), Columns(17)).Hidden = False
.Range(Columns(6), Columns(7)).Hidden = True
.Columns(22).Hidden = False
.Columns(18).Hidden = True
.ToggleButton4.Visible = True
End With
For i = 4 To 12
For k = 18 To 20
For t = 6 To 8
With Sheets(i)
.Columns(k).Hidden = False
.Columns(t).Hidden = True
.Columns(25).Hidden = False
.ToggleButton2.Visible = True
End With
Next
Next
Nex

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Range of columns

You can hide columns on another sheet with something like:

worksheets("sheet99").range("o1:q1,s1").entirecolu mn.hidden = true

Columns o:q and s will be hidden.

====
I'm kind of lost with your code, but in general, if you're working with a
different sheet, it's better to fully qualify your ranges:

with worksheets("sheet99")
.Range(.Columns(15), .Columns(17)).Hidden = False
end with

Note the dots in front of .range and both .columns.

If you leave those dots off, then columns(15) will refer to the activesheet (if
the code is in a General module) or it will refer to the sheet owning the
code--if it's in a worksheet module.



"fragher75 <" wrote:

Hello...
I have that problem (excuse me for my english)..
Why in sheet "me" I can use:

Range(Columns(15), Columns(17)).Hidden = False

and in another sheets can't I?
I used a For cycle to do it!

For k = 18 To 20
Columns(k).Hidden = False

Is there another way to hidden a range of columns in another sheets?
How can I hidden that columns(15,16,17 e 21) in another sheets with
only row of code?
Thanks
Francesco

ToggleButton3.Caption = "Nascondi Previsioni"
With Me
Range(Columns(15), Columns(17)).Hidden = False
Range(Columns(6), Columns(7)).Hidden = True
Columns(22).Hidden = False
Columns(18).Hidden = True
ToggleButton4.Visible = True
End With
For i = 4 To 12
For k = 18 To 20
For t = 6 To 8
With Sheets(i)
Columns(k).Hidden = False
Columns(t).Hidden = True
Columns(25).Hidden = False
ToggleButton2.Visible = True
End With
Next
Next
Next

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

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
Select different columns within a range Kiran Charts and Charting in Excel 0 March 8th 10 01:22 PM
Sum a range of columns ? Ainsley Excel Discussion (Misc queries) 6 May 9th 06 10:43 AM
looping across columns in range? Amy Excel Discussion (Misc queries) 3 July 19th 05 08:01 PM
Range of columns hotherps[_94_] Excel Programming 10 August 10th 04 10:41 PM
No of columns in range Ron McCormick[_2_] Excel Programming 1 October 8th 03 04:36 PM


All times are GMT +1. The time now is 08:10 PM.

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"