Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

operations on multiple selections

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How can I do , in VBA, same operations on multiples selections (cells selected with CTRL )?
 
Are you looking for something like this ?

Sub Sample()

For Each Cell In Selection
Cell.Value = "HELLO"
Next Cell

End Sub
 
You can use something like

Range("A1:A5,B6:B10,C11:C15").Select, which selects 3 non-contiguous areas, or do it with the Union operator as follows,
Code:
Dim oSelect As Range
   Set oSelect = Union([A1:A5], [B6:B10], [C11:c15])
oSelect.Select
A.C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top