View Full Version : Solved: multi columns selected
slamet Harto
06-09-2010, 08:23 PM
Hi there
How do i chance this
For Each c In Intersect(.UsedRange, .Columns("T:Z")).Cells
if i want to multi select some column eg: T,V,Z columns only
I use " For each c in selection" instead of above but i have to select manually before run the code.
appreciate for your help.
Rgds, Harto
domfootwear
06-09-2010, 08:29 PM
Hi there
How do i chance this
For Each c In Intersect(.UsedRange, .Columns("T:Z")).Cells
if i want to multi select some column eg: T,V,Z columns only
I use " For each c in selection" instead of above but i have to select manually before run the code.
appreciate for your help.
Rgds, Harto
You have to use Union like this
Application.Union(...,...)
slamet Harto
06-09-2010, 09:16 PM
is it like this
Set ColRng = Application.Union(["T1:T65536"], ["V1:Z65536"], _["Z1:Z65536"])
ColRng.Select
For each c in ColRng
But showing run time 424 - Object required
domfootwear
06-09-2010, 09:28 PM
is it like this
Set ColRng = Application.Union(["T1:T65536"], ["V1:Z65536"], _["Z1:Z65536"])
ColRng.Select
For each c in ColRng
But showing run time 424 - Object required
Select 3 columns (T,V,Z) in Sheet1:
Sub Test()
With Sheet1
colrng = Application.Union(.Columns("t"), .Columns("v"), .Columns("z")).Select
End With
End Sub
mikerickson
06-09-2010, 09:54 PM
Dim c as Range
For Each c In Application.Intersect(Range("T1,V1,Z1").EntireColumn, UsedRange)
Rem do stuff
Next c
slamet Harto
06-10-2010, 12:27 AM
thanks all.
i use For Each c In Application.Union(.Columns("t"), .Columns("v"), .Columns("z")).
Bob Phillips
06-10-2010, 02:29 AM
You could have used
For Each c In Intersect(.UsedRange, .Range("T:T, V:V, Z:Z")).Cells
slamet Harto
06-10-2010, 06:11 AM
thanks bob
appreciated it so much
cheers
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.