ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change event help (https://www.excelbanter.com/excel-programming/322372-change-event-help.html)

jimbola

Change event help
 
Hi there,

I want to create a change event macro that when a change
is made to the first 2 cells in a row, a formula is copied
from the very first row into the next 5 cells of the row
where the change was made.
Hope the layout below makes sense, f1 - f5 represent
formulas.

a b c d e f g
1 Name Rate f1 f2 f3 f4 f5

..
..
..
30 john 12.50 (copy formulas f1 - f5 down here on
change)

Any help would be grately appreciated.

Regards
J

Tom Ogilvy

Change event help
 
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
On Error GoTo ErrHandler
If Target.Column = 1 Or Target.Column = 2 Then
Application.EnableEvents = False
set rng = Cells(1, 3).Resize(1, 5)
rng.copy cells(Target.row,3)
End If
ErrHandler:
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy

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

I want to create a change event macro that when a change
is made to the first 2 cells in a row, a formula is copied
from the very first row into the next 5 cells of the row
where the change was made.
Hope the layout below makes sense, f1 - f5 represent
formulas.

a b c d e f g
1 Name Rate f1 f2 f3 f4 f5

.
.
.
30 john 12.50 (copy formulas f1 - f5 down here on
change)

Any help would be grately appreciated.

Regards
J





All times are GMT +1. The time now is 11:37 PM.

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