Nov 10 2020 06:13 AM - edited Nov 10 2020 06:17 AM
i want to do something like this:
if A1 is 0xE1 B1 is 1 then copy A1 to C1 , then whatever B1 change to other number C1 doesn't change,
can i make it happen only use excel?
Nov 10 2020 06:26 AM - edited Nov 10 2020 06:27 AM
Hello @johnny85824,
Just so I am understanding correctly... you would like a formula in cell C1 to be dependent on the values in cells A1 and B1 but if B1 changes and a value was already printed in C1, then C1 should not change?
Nov 10 2020 06:32 AM
Nov 10 2020 08:33 AM
@johnny85824
The following VBA code will check for "0xE1" in cell A1 and 1 in cell B1. If true, then cell A1 will be copied and pasted to cell C1. If not, then nothing will be done.
Sub My_Code()
If Range("A1") = "0xE1" _
And Range("B1") = 1 _
Then
Range("A1").Select
Selection.Copy
Range("C1").Select
ActiveSheet.Paste
End If
End Sub
You can assign this code to a button or shortcut key using the Developer tab.