ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Selecting a range of cells in a macro (https://www.excelbanter.com/excel-discussion-misc-queries/196227-selecting-range-cells-macro.html)

Victor Delta[_2_]

Selecting a range of cells in a macro
 
Can anyone help me with this please.

I have written an Excel (XP) macro that has to start by selecting a range
based on the active cell and the 10 cells to its right.

How do I put this into VBA code please?

Thanks,

V


JLatham

Selecting a range of cells in a macro
 
Here's one way:

Range(ActiveCell.Address & ":" & ActiveCell.Offset(0, 10).Address).Select

Hope that helps.

"Victor Delta" wrote:

Can anyone help me with this please.

I have written an Excel (XP) macro that has to start by selecting a range
based on the active cell and the 10 cells to its right.

How do I put this into VBA code please?

Thanks,

V



Dave Peterson

Selecting a range of cells in a macro
 
activecell.resize(1,11).select



Victor Delta wrote:

Can anyone help me with this please.

I have written an Excel (XP) macro that has to start by selecting a range
based on the active cell and the 10 cells to its right.

How do I put this into VBA code please?

Thanks,

V


--

Dave Peterson

JLatham

Selecting a range of cells in a macro
 
And Dave Peterson's method is probably faster and more efficient than mine.

"Dave Peterson" wrote:

activecell.resize(1,11).select



Victor Delta wrote:

Can anyone help me with this please.

I have written an Excel (XP) macro that has to start by selecting a range
based on the active cell and the 10 cells to its right.

How do I put this into VBA code please?

Thanks,

V


--

Dave Peterson


Dave Peterson

Selecting a range of cells in a macro
 
But no matter which one is used, the OP should be able to read either to see how
each can be extended to different situations.

JLatham wrote:

And Dave Peterson's method is probably faster and more efficient than mine.

"Dave Peterson" wrote:

activecell.resize(1,11).select



Victor Delta wrote:

Can anyone help me with this please.

I have written an Excel (XP) macro that has to start by selecting a range
based on the active cell and the 10 cells to its right.

How do I put this into VBA code please?

Thanks,

V


--

Dave Peterson


--

Dave Peterson

Victor Delta[_2_]

Selecting a range of cells in a macro
 
"Dave Peterson" wrote in message
...
But no matter which one is used, the OP should be able to read either to
see how
each can be extended to different situations.


Very many thanks to you both.

V



All times are GMT +1. The time now is 08:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com