You are here VBA and Macro Select multiple areas automatically when cell is clicked

Select multiple areas automatically when cell is clicked

Program VBA : How to Select multiple areas automatically when cell is clicked

Code in VBA:

Step 1: Right click on sheet that you want to select range automatically.

Step 2: Copy code below:

'--------------------------------------------------------------

Option Explicit
'Nguyen Duy Tuan - duytuan@bluesofts.net
'Website: http://bluesofts.net - duytuan@bluesofts.net
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Row <> 9 Then Exit Sub
    Dim FixedRng As Range
    Set FixedRng = Range("A9:A10,A12:A14") 'Dau , ngan cach vung
    FixedRng.Offset(, Target.Column - 1).Select 'Chon vung - Select range
End Sub
'--------------------------------------------------------------