We help IT Professionals succeed at work.

simple VBA question

If I have a2:c6 selected how do I reduce the selected area to b2:c6 using VBA?
Comment
Watch Question

Kyle AbrahamsSenior .Net Developer
CERTIFIED EXPERT

Commented:
Range("b2:c6").Select
Analyst Assistant
CERTIFIED EXPERT
Commented:
There are various ways, here's one.
Selection.Resize(,Selection.Columns.Count-1).Offset(,1).Select

Open in new window

Martin LissSocial distance - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Oops. Too late.

Commented:
Private Sub Command1_Click()
    On Error Resume Next
    Set o = GetObject(, "Excel.Application")
    o.Visible = True
    DoEvents
    o.ActiveSheet.Range("B2:C6").Select
End Sub

Author

Commented:
Exactly what I wanted.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.