ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   COPY FORMULA TO THE LAST CELL (https://www.excelbanter.com/excel-programming/405984-copy-formula-last-cell.html)

K[_2_]

COPY FORMULA TO THE LAST CELL
 
I got formulas in cells "G5" , "H5" , "I5" , "J5" and "K5" and I got
data in
coloumn "A" aswell. I want Macro to copy the formulas looking at
coloumn "A" data. Like if I got data or values in coloumn "A" from
cell
"A5" to cell "A100" then Macro should copy formulas from
cells "G5" , "H5" , "I5" , "J5" to cells "G100" , "H100" , "I100" ,
"J100"
In other words Macro should always look data to last cell of coloumn
"A" and copy formulas in coloumns "G" , "H" , "I" , "J" and "K" to
same
last cell where the data ends in coloumn "A". Please If anybody can
help.

Roger Govier[_3_]

COPY FORMULA TO THE LAST CELL
 
Hi

Try

Sub ExtendFormulae()
Dim lr As Long

Sheets("Sheet1").Activate
lr = Cells(Rows.Count, "A").End(xlUp).Row
Range("G5:K5").Copy Range("G5").Offset(0, 0).Range("A1:A" & lr - 4)
Application.CutCopyMode = False

End Sub


--
Regards
Roger Govier

"K" wrote in message
...
I got formulas in cells "G5" , "H5" , "I5" , "J5" and "K5" and I got
data in
coloumn "A" aswell. I want Macro to copy the formulas looking at
coloumn "A" data. Like if I got data or values in coloumn "A" from
cell
"A5" to cell "A100" then Macro should copy formulas from
cells "G5" , "H5" , "I5" , "J5" to cells "G100" , "H100" , "I100" ,
"J100"
In other words Macro should always look data to last cell of coloumn
"A" and copy formulas in coloumns "G" , "H" , "I" , "J" and "K" to
same
last cell where the data ends in coloumn "A". Please If anybody can
help.



K[_2_]

COPY FORMULA TO THE LAST CELL
 
On 12 Feb, 17:13, "Roger Govier" <roger@technology4unospamdotcodotuk
wrote:
Hi

Try

Sub ExtendFormulae()
Dim lr As Long

* * Sheets("Sheet1").Activate
* * lr = Cells(Rows.Count, "A").End(xlUp).Row
* * Range("G5:K5").Copy Range("G5").Offset(0, 0).Range("A1:A" & lr - 4)
* * Application.CutCopyMode = False

End Sub

--
Regards
Roger Govier

"K" wrote in message

...



I got formulas in cells "G5" , "H5" , "I5" , "J5" and "K5" and I got
data in
coloumn "A" aswell. I want Macro to copy the formulas looking at
coloumn "A" data. Like if I got data or values in coloumn "A" from
cell
"A5" to cell "A100" then Macro should copy formulas from
cells "G5" , "H5" , "I5" , "J5" to cells "G100" , "H100" , "I100" ,
"J100"
In other words Macro should always look data to last cell of coloumn
"A" and copy formulas in coloumns "G" , "H" , "I" , "J" and "K" to
same
last cell where the data ends in coloumn "A". *Please If anybody can
help.- Hide quoted text -


- Show quoted text -


Thanks Roger. your Macro was very helpful


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

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