ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cell reference (https://www.excelbanter.com/excel-programming/320349-cell-reference.html)

Marisa

cell reference
 
Hi there,

I am using excel 2002. I want to write a macro to copy an area of cells (4
rows by 4 columns) to 1 row down. e.g. source cells A1:D4, then destination
cells be A2:D5.

The starting cell should be the current active cell. Actually the column is
fixed, always A to D, only the row reference need to be refer to the active
cell.
How should the macro be?

Thanks a lot!
Marisa


Claud Balls

cell reference
 
sub rowins()
activesheet.rows(1).insert shift:=xldown
end sub


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Marisa

cell reference
 
Thanks Claud,
I have tried this but it copy the whole row down. I only want to copy the
area 4 rows by 4 columns (16 cells) down.
Can you advise. Thanks a lot!
Marisa

"Claud Balls" wrote:

sub rowins()
activesheet.rows(1).insert shift:=xldown
end sub


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Bob Phillips[_6_]

cell reference
 
With ActiveCell
.Resize(4, 4).Cut Destination:=.Offset(1, 0).Resize(4, 4)
End With


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Marisa" wrote in message
...
Hi there,

I am using excel 2002. I want to write a macro to copy an area of cells

(4
rows by 4 columns) to 1 row down. e.g. source cells A1:D4, then

destination
cells be A2:D5.

The starting cell should be the current active cell. Actually the column

is
fixed, always A to D, only the row reference need to be refer to the

active
cell.
How should the macro be?

Thanks a lot!
Marisa




Marisa

cell reference
 
Dear Bob,
I don't get it. Is it a stand alone macro or should be within other lines?
Thanks,
Marisa

"Bob Phillips" wrote:

With ActiveCell
.Resize(4, 4).Cut Destination:=.Offset(1, 0).Resize(4, 4)
End With


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Marisa" wrote in message
...
Hi there,

I am using excel 2002. I want to write a macro to copy an area of cells

(4
rows by 4 columns) to 1 row down. e.g. source cells A1:D4, then

destination
cells be A2:D5.

The starting cell should be the current active cell. Actually the column

is
fixed, always A to D, only the row reference need to be refer to the

active
cell.
How should the macro be?

Thanks a lot!
Marisa





Dave Peterson[_5_]

cell reference
 
First, do you really mean copy or do you want cut?

If you mean copy:

Option Explicit
Sub testme01()
With ActiveSheet
.Cells(ActiveCell.Row, "A").Resize(4, 4).Copy _
Destination:=.Cells(ActiveCell.Row + 1, "A")
End With
End Sub

Change the .Copy to .Cut if you want that range moved.


Marisa wrote:

Hi there,

I am using excel 2002. I want to write a macro to copy an area of cells (4
rows by 4 columns) to 1 row down. e.g. source cells A1:D4, then destination
cells be A2:D5.

The starting cell should be the current active cell. Actually the column is
fixed, always A to D, only the row reference need to be refer to the active
cell.
How should the macro be?

Thanks a lot!
Marisa


--

Dave Peterson


All times are GMT +1. The time now is 01:54 AM.

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