ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding to a selection? (https://www.excelbanter.com/excel-programming/367166-adding-selection.html)

[email protected]

Adding to a selection?
 
Can someone tell me how to add to an existing selection?

For example:

Range("A1, C1").Select
.....then later on I want to keep "A1" and "C1" selected, but add on
more selected more cells.

In "english" it would be Selection = Selection + New Selection

Thanks!


Dave Peterson

Adding to a selection?
 
You can use Union to combine ranges. But it's not usually required to select
any range to work on them.

dim myRng as range
set myrng = .range("a1:C1")
'myrng.select

set myrng = union(myrng, range("d3:d77"))
'myrng.select




wrote:

Can someone tell me how to add to an existing selection?

For example:

Range("A1, C1").Select
....then later on I want to keep "A1" and "C1" selected, but add on
more selected more cells.

In "english" it would be Selection = Selection + New Selection

Thanks!


--

Dave Peterson


All times are GMT +1. The time now is 05:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com