Solved

simple VBA question

Posted on 2012-03-13
5
437 Views
Last Modified: 2012-03-13
If I have a2:c6 selected how do I reduce the selected area to b2:c6 using VBA?
0
Comment
Question by:BigWill5112
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 37715348
Range("b2:c6").Select
0
 
LVL 34

Accepted Solution

by:
Norie earned 500 total points
ID: 37715377
There are various ways, here's one.
Selection.Resize(,Selection.Columns.Count-1).Offset(,1).Select

Open in new window

0
 
LVL 48

Expert Comment

by:Martin Liss
ID: 37715382
Oops. Too late.
0
 
LVL 17

Expert Comment

by:vb_elmar
ID: 37715394
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
0
 

Author Closing Comment

by:BigWill5112
ID: 37715447
Exactly what I wanted.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question