McM_
New Member
- Joined
- Oct 23, 2023
- Messages
- 23
- Office Version
- 365
- Platform
- Windows
Hello, please, a code that automatically activates the formulas in the sheet, without the need to activate Macros with F5. In Example 1 I took a simple formula just to see the code that automatically activates the formulas in the sheet.
In examples 2 and 3, I have codes that are automatically activated in the sheet when a condition is met.
Thank you!
In examples 2 and 3, I have codes that are automatically activated in the sheet when a condition is met.
Thank you!
VBA Code:
Sub Macrocomandã5()
Range("C2:C8").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-2]>0,(RC[-2]+RC[-1]),"""")"
Range("C2:C8").Select
Range("C3").Activate
End Sub
Private Sub worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet
If Target.Column = 5 Then
Range("F" & Target.Row) = Now
End If
If Target.Column = 10 Then
Range("I2:I" & Target.Row) = Range("H2")
End If
End Sub
VBA.xlsm | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | |||
1 | didn`t work | work | work | write here | |||||||||
2 | 1 | 2 | 3 | fdgf | 28.10.2023 08:20 | test | test | jhkhj | |||||
3 | 3 | 4 | didn`t work | fdgfd | 28.10.2023 08:20 | test | jk | ||||||
4 | 5 | 9 | didn`t work | dfgd | 28.10.2023 08:20 | test | hkh | ||||||
5 | 4 | didn`t work | test | hkh | |||||||||
6 | didn`t work | ||||||||||||
7 | didn`t work | ||||||||||||
8 | |||||||||||||
9 | |||||||||||||
10 | EXAMPLE 1 | EXAMPLE 2 | EXAMPLE 3 | ||||||||||
11 | |||||||||||||
Foaie1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
C2,C11,C8 | C2 | =IF(A2>0,(A2+B2),"") |