Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple Discrete Columns Selection
Hi all,
Sorry for this stupid question. If I want to select Columns H, Q, R, S at the same time, how can achieve this by VBA code? Thanks -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple Discrete Columns Selection
|
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple Discrete Columns Selection
Thx for quick reply.
One more question. Suppose I declare the range Y to be the above one mentioned. How can intersect the used range with the range Y so that other columns i selected? To illustrate: A B C <-- Column C is selected to be range Y Now I want to select columns A and B, not C to be selected. Thanks -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple Discrete Columns Selection
Dim y as Range, rng as Range, col as Range
set y = Range("H:H,Q:S") for each col in Activesheet.UsedRange.Columns if intersect(col,y) is nothing then if rng is nothing then set rng = col else set rng = union(rng,col) end if End if Next ' if you want the entire column if not rng is nothing then set rng = rng.entireColumn msgbox rng.Address End if -- Regards, Tom Ogilvy "kaon " wrote in message ... Thx for quick reply. One more question. Suppose I declare the range Y to be the above one mentioned. How can I intersect the used range with the range Y so that other columns is selected? To illustrate: A B C <-- Column C is selected to be range Y Now I want to select columns A and B, not C to be selected. Thanks. --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple Discrete Columns Selection
Oh thanks.
Seems I should spend more time on developing the right code. : -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple Selection when Grouping columns | Excel Discussion (Misc queries) | |||
2 stacked, one discrete | Charts and Charting in Excel | |||
Break a table into discrete info | Excel Discussion (Misc queries) | |||
Selecting Multiple Columns in a Named Selection | Excel Worksheet Functions | |||
Drop-down selection fills data across multiple columns | Excel Discussion (Misc queries) |