In my Active worksheet, I have the following code; If Target.Address = "$B$3" Then…
- User
In my Active worksheet, I have the following code; If Target.Address = "3" Then Sheets("Job Request").Activate End If What I would like to do is this, when the code runs then the value of cell A1 in sheet 'Job Request' becomes the value of B1 from my Active Sheet. Something like this; If Target.Address = "3" Then ActiveSheet.Range("B2").copy values only Sheets("Job Request").Activate ActiveSheet.Range("A1").paste values only End If
How can I do this
- Assistant
You can achieve this by modifying your code as follows:
pythonIf Target.Address = "$B$3" Then Dim copiedValue As Variant copiedValue = ActiveSheet.Range("B1").Value Sheets("Job Request").Activate ActiveSheet.Range("A1").Value = copiedValue End IfThis code checks if the changed cell is B3, then it stores the value of cell B1 in a variable called
copiedValue. After that, it activates the "Job Request" worksheet, selects cell A1, and assigns thecopiedValueto that cell. By doing this, the value of B1 in the active sheet will be copied to A1 of the "Job Request" sheet.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.