PDA

View Full Version : Copy and paste macro different worksheets



keilah
09-20-2007, 01:42 AM
Hi

Need a macro that well copy dow al the formula in the following worksheets:

1. DataType cell range A2:I2
2. AcquisitionAmounts cell range A2:I2
and finally
3. Flowdata cell range A2:J2

just simply copy the formula in each of the following ranges all the way down to row 4000.....

thanks

Bob Phillips
09-20-2007, 01:50 AM
With Worksheets("DataType")
.Range("A2:I2").AutoFill .Range("A2:I4000")
End With

With Worksheets("AcquisitionAmounts")
.Range("A2:I2").AutoFill .Range("A2:I4000")
End With

With Worksheets("FlowData")
.Range("A2:J2").AutoFill .Range("A2:J4000")
End With

keilah
09-20-2007, 01:57 AM
Thanks for the feed back......

mdmackillop
09-20-2007, 03:05 AM
You could also consider an array. Neater with longer lists

Dim arr, a
arr = Array("DataType", "AcquisitionAmounts", "FlowData")
For Each a In arr
With Worksheets(a)
.Range("A2:I2").AutoFill .Range("A2:I4000")
End With
Next

Bob Phillips
09-20-2007, 03:06 AM
It wasnt A2:I2 in every case, there was a A2:J2 in there.

mdmackillop
09-20-2007, 03:08 AM
footinmout