Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
dave glynn
 
Posts: n/a
Default repeat macro formula to all cells

i have data spread across 6 columns and 300 rows. I have written a macro that
moves data from row 3 to row 1. I want to repeat the macro so that it
performs the move for row 6 to row 4, row 9 to line 7 etc. Do i have to paste
and copy the macro or is there a way of writing it only once so that it
repeats till the end of the range?
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default


For i = 3 to 303
Cells(i,"A").Entirerow.copy destination:=Cells(i-2,"A")
Next i


--

HTH

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


"dave glynn" wrote in message
...
i have data spread across 6 columns and 300 rows. I have written a macro

that
moves data from row 3 to row 1. I want to repeat the macro so that it
performs the move for row 6 to row 4, row 9 to line 7 etc. Do i have to

paste
and copy the macro or is there a way of writing it only once so that it
repeats till the end of the range?



  #3   Report Post  
dave glynn
 
Posts: n/a
Default

Hi Bob,

Many thanks. What value(s) do Isubstitute for "A"?

Dave

"Bob Phillips" wrote:


For i = 3 to 303
Cells(i,"A").Entirerow.copy destination:=Cells(i-2,"A")
Next i


--

HTH

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


"dave glynn" wrote in message
...
i have data spread across 6 columns and 300 rows. I have written a macro

that
moves data from row 3 to row 1. I want to repeat the macro so that it
performs the move for row 6 to row 4, row 9 to line 7 etc. Do i have to

paste
and copy the macro or is there a way of writing it only once so that it
repeats till the end of the range?




  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Dave,

You can leave it as A, that just signifies the column, but as you copy the
whole row it doesn't matter.

--

HTH

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


"dave glynn" wrote in message
...
Hi Bob,

Many thanks. What value(s) do Isubstitute for "A"?

Dave

"Bob Phillips" wrote:


For i = 3 to 303
Cells(i,"A").Entirerow.copy destination:=Cells(i-2,"A")
Next i


--

HTH

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


"dave glynn" wrote in message
...
i have data spread across 6 columns and 300 rows. I have written a

macro
that
moves data from row 3 to row 1. I want to repeat the macro so that it
performs the move for row 6 to row 4, row 9 to line 7 etc. Do i have

to
paste
and copy the macro or is there a way of writing it only once so that

it
repeats till the end of the range?






  #5   Report Post  
Dana DeLouis
 
Posts: n/a
Default

Another option for the Entire Row might be:

Dim R As Long 'Row
For R = 3 To 303
Rows(R).Copy Rows(R - 2)
Next R

performs the move for row 6 to row 4, row 9 to line 7 etc....


Not sure, but if you really meant to copy every third row, consider
something like:
For R = 6 To 303 Step 3

--
Dana DeLouis
Win XP & Office 2003


"Bob Phillips" wrote in message
...
Dave,

You can leave it as A, that just signifies the column, but as you copy the
whole row it doesn't matter.

--

HTH

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


"dave glynn" wrote in message
...
Hi Bob,

Many thanks. What value(s) do Isubstitute for "A"?

Dave

"Bob Phillips" wrote:


For i = 3 to 303
Cells(i,"A").Entirerow.copy destination:=Cells(i-2,"A")
Next i


--

HTH

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


"dave glynn" wrote in message
...
i have data spread across 6 columns and 300 rows. I have written a

macro
that
moves data from row 3 to row 1. I want to repeat the macro so that it
performs the move for row 6 to row 4, row 9 to line 7 etc. Do i have

to
paste
and copy the macro or is there a way of writing it only once so that

it
repeats till the end of the range?









  #6   Report Post  
dave glynn
 
Posts: n/a
Default

Hi Dana,

Thanks a lot.

I wasn't too clear in my original note.

What I need to do is to move the values in e3 and f3 to e1 and f1, e6 anf f6
to e4 and f4 and so on whilst retaining the rest of the original data in its
original cells.

Dave

"Dana DeLouis" wrote:

Another option for the Entire Row might be:

Dim R As Long 'Row
For R = 3 To 303
Rows(R).Copy Rows(R - 2)
Next R

performs the move for row 6 to row 4, row 9 to line 7 etc....


Not sure, but if you really meant to copy every third row, consider
something like:
For R = 6 To 303 Step 3

--
Dana DeLouis
Win XP & Office 2003


"Bob Phillips" wrote in message
...
Dave,

You can leave it as A, that just signifies the column, but as you copy the
whole row it doesn't matter.

--

HTH

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


"dave glynn" wrote in message
...
Hi Bob,

Many thanks. What value(s) do Isubstitute for "A"?

Dave

"Bob Phillips" wrote:


For i = 3 to 303
Cells(i,"A").Entirerow.copy destination:=Cells(i-2,"A")
Next i


--

HTH

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


"dave glynn" wrote in message
...
i have data spread across 6 columns and 300 rows. I have written a

macro
that
moves data from row 3 to row 1. I want to repeat the macro so that it
performs the move for row 6 to row 4, row 9 to line 7 etc. Do i have

to
paste
and copy the macro or is there a way of writing it only once so that

it
repeats till the end of the range?








  #7   Report Post  
Bob Phillips
 
Posts: n/a
Default

For i = 3 to 303
Cells(i,"E").Resize(1,2).copy destination:=Cells(i-2,"E")
Next i



--

HTH

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


"dave glynn" wrote in message
...
Hi Dana,

Thanks a lot.

I wasn't too clear in my original note.

What I need to do is to move the values in e3 and f3 to e1 and f1, e6 anf

f6
to e4 and f4 and so on whilst retaining the rest of the original data in

its
original cells.

Dave

"Dana DeLouis" wrote:

Another option for the Entire Row might be:

Dim R As Long 'Row
For R = 3 To 303
Rows(R).Copy Rows(R - 2)
Next R

performs the move for row 6 to row 4, row 9 to line 7 etc....


Not sure, but if you really meant to copy every third row, consider
something like:
For R = 6 To 303 Step 3

--
Dana DeLouis
Win XP & Office 2003


"Bob Phillips" wrote in message
...
Dave,

You can leave it as A, that just signifies the column, but as you copy

the
whole row it doesn't matter.

--

HTH

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


"dave glynn" wrote in message
...
Hi Bob,

Many thanks. What value(s) do Isubstitute for "A"?

Dave

"Bob Phillips" wrote:


For i = 3 to 303
Cells(i,"A").Entirerow.copy destination:=Cells(i-2,"A")
Next i


--

HTH

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


"dave glynn" wrote in message
...
i have data spread across 6 columns and 300 rows. I have written

a
macro
that
moves data from row 3 to row 1. I want to repeat the macro so

that it
performs the move for row 6 to row 4, row 9 to line 7 etc. Do i

have
to
paste
and copy the macro or is there a way of writing it only once so

that
it
repeats till the end of the range?










  #8   Report Post  
dave glynn
 
Posts: n/a
Default

Thanks Bob, works perfetly!!!

"Bob Phillips" wrote:

For i = 3 to 303
Cells(i,"E").Resize(1,2).copy destination:=Cells(i-2,"E")
Next i



--

HTH

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


"dave glynn" wrote in message
...
Hi Dana,

Thanks a lot.

I wasn't too clear in my original note.

What I need to do is to move the values in e3 and f3 to e1 and f1, e6 anf

f6
to e4 and f4 and so on whilst retaining the rest of the original data in

its
original cells.

Dave

"Dana DeLouis" wrote:

Another option for the Entire Row might be:

Dim R As Long 'Row
For R = 3 To 303
Rows(R).Copy Rows(R - 2)
Next R

performs the move for row 6 to row 4, row 9 to line 7 etc....

Not sure, but if you really meant to copy every third row, consider
something like:
For R = 6 To 303 Step 3

--
Dana DeLouis
Win XP & Office 2003


"Bob Phillips" wrote in message
...
Dave,

You can leave it as A, that just signifies the column, but as you copy

the
whole row it doesn't matter.

--

HTH

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


"dave glynn" wrote in message
...
Hi Bob,

Many thanks. What value(s) do Isubstitute for "A"?

Dave

"Bob Phillips" wrote:


For i = 3 to 303
Cells(i,"A").Entirerow.copy destination:=Cells(i-2,"A")
Next i


--

HTH

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


"dave glynn" wrote in message
...
i have data spread across 6 columns and 300 rows. I have written

a
macro
that
moves data from row 3 to row 1. I want to repeat the macro so

that it
performs the move for row 6 to row 4, row 9 to line 7 etc. Do i

have
to
paste
and copy the macro or is there a way of writing it only once so

that
it
repeats till the end of the range?











  #9   Report Post  
Bob Phillips
 
Posts: n/a
Default

Glad we got there.

Regards

Bob


"dave glynn" wrote in message
...
Thanks Bob, works perfetly!!!

"Bob Phillips" wrote:

For i = 3 to 303
Cells(i,"E").Resize(1,2).copy destination:=Cells(i-2,"E")
Next i



--

HTH

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


"dave glynn" wrote in message
...
Hi Dana,

Thanks a lot.

I wasn't too clear in my original note.

What I need to do is to move the values in e3 and f3 to e1 and f1, e6

anf
f6
to e4 and f4 and so on whilst retaining the rest of the original data

in
its
original cells.

Dave

"Dana DeLouis" wrote:

Another option for the Entire Row might be:

Dim R As Long 'Row
For R = 3 To 303
Rows(R).Copy Rows(R - 2)
Next R

performs the move for row 6 to row 4, row 9 to line 7 etc....

Not sure, but if you really meant to copy every third row, consider
something like:
For R = 6 To 303 Step 3

--
Dana DeLouis
Win XP & Office 2003


"Bob Phillips" wrote in message
...
Dave,

You can leave it as A, that just signifies the column, but as you

copy
the
whole row it doesn't matter.

--

HTH

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


"dave glynn" wrote in

message
...
Hi Bob,

Many thanks. What value(s) do Isubstitute for "A"?

Dave

"Bob Phillips" wrote:


For i = 3 to 303
Cells(i,"A").Entirerow.copy destination:=Cells(i-2,"A")
Next i


--

HTH

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


"dave glynn" wrote in

message
...
i have data spread across 6 columns and 300 rows. I have

written
a
macro
that
moves data from row 3 to row 1. I want to repeat the macro so

that it
performs the move for row 6 to row 4, row 9 to line 7 etc. Do

i
have
to
paste
and copy the macro or is there a way of writing it only once

so
that
it
repeats till the end of the range?













Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you copy a cell's content verses it's formula? Tammy Excel Discussion (Misc queries) 1 March 2nd 05 06:30 PM
My formula screws up other reference cells... Jambruins Excel Discussion (Misc queries) 2 February 28th 05 02:57 PM
Cells displays formula, not results synaptic5150 Excel Worksheet Functions 1 January 19th 05 09:56 PM
to copy a formula in cell c1 (+b1/b11) to cells c2-10, how can i . bvi Excel Worksheet Functions 3 December 23rd 04 06:14 PM
Macro Formula revision? Mark Excel Worksheet Functions 1 November 28th 04 01:43 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"