Macro-active cell

P

puiuluipui

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!
 
M

Mike H

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.
 
M

Mike H

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.
 
P

puiuluipui

It's working great!!
Thanks!

Mike H said:
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.
 

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

Similar Threads

macro pick 100 lines 4
Macro Not Running 2
SELECTION macro 1
Active cell 4
Macro Question formula 8
Paste cell to last row in range 6
High Lighting cells with conditional colour formats 1
MACRO Problem 1

Top