How do I select certain cells within a row?

  • Thread starter Thread starter CW
  • Start date Start date
C

CW

Hello,

I have this command that selects the current row:

ActiveCell.EntireRow.Select

....but I just want to select the first 4 cells in the row, for
instance:

Range("A1:D1").Select

.... now say I'm using the command within a loop, so I can't reference
a specific Range. How can I tell the macro to just select the first 4
cells in the current row?

Thanks for any help!
 
Try something like

ActiveSheet.Cells(ActiveCell.Row, 1).Resize(1, 4).Select

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)


wrote in message
news:[email protected]...
 
Hello,

I have this command that selects the current row:

ActiveCell.EntireRow.Select

...but I just want to select the first 4 cells in the row, for
instance:

Range("A1:D1").Select

... now say I'm using the command within a loop, so I can't reference
a specific Range. How can I tell the macro to just select the first 4
cells in the current row?

Thanks for any help!

This should work:

With ActiveCell.EntireRow
.Range(.Cells(1, 1), .Cells(1, 4)).Select
End With
 
This should work:

With ActiveCell.EntireRow
.Range(.Cells(1, 1), .Cells(1, 4)).Select
End With

Awesome. Both work perfectly. Thanks Linda and Chip!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top