ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro-active cell (https://www.excelbanter.com/excel-discussion-misc-queries/258857-macro-active-cell.html)

puiuluipui

Macro-active cell
 
Hi, i have this code that will select from active sheet 20 cells below, on
the column.
can this code be made to select 20 cells to the right, on row?

Range(ActiveCell, Cells(ActiveCell.Row + 20, ActiveCell.Column)).Select

Can this be done?
Thanks!

Mike H

Macro-active cell
 
Hi,

Your line of code can be simplified to

ActiveCell.Resize(21).Select

and for a column

ActiveCell.Resize(, 21).Select

My usual caveat is that no matter what you trying to do it's extremely
unlikely you need to select to do it

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"puiuluipui" wrote:

Hi, i have this code that will select from active sheet 20 cells below, on
the column.
can this code be made to select 20 cells to the right, on row?

Range(ActiveCell, Cells(ActiveCell.Row + 20, ActiveCell.Column)).Select

Can this be done?
Thanks!


Mike H

Macro-active cell
 
and you can combine both

ActiveCell.Resize(21, 21).Select
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Mike H" wrote:

Hi,

Your line of code can be simplified to

ActiveCell.Resize(21).Select

and for a column

ActiveCell.Resize(, 21).Select

My usual caveat is that no matter what you trying to do it's extremely
unlikely you need to select to do it

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"puiuluipui" wrote:

Hi, i have this code that will select from active sheet 20 cells below, on
the column.
can this code be made to select 20 cells to the right, on row?

Range(ActiveCell, Cells(ActiveCell.Row + 20, ActiveCell.Column)).Select

Can this be done?
Thanks!


puiuluipui

Macro-active cell
 
It's working great!!
Thanks!

"Mike H" wrote:

Hi,

Your line of code can be simplified to

ActiveCell.Resize(21).Select

and for a column

ActiveCell.Resize(, 21).Select

My usual caveat is that no matter what you trying to do it's extremely
unlikely you need to select to do it

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"puiuluipui" wrote:

Hi, i have this code that will select from active sheet 20 cells below, on
the column.
can this code be made to select 20 cells to the right, on row?

Range(ActiveCell, Cells(ActiveCell.Row + 20, ActiveCell.Column)).Select

Can this be done?
Thanks!



All times are GMT +1. The time now is 02:23 PM.

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