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
To achieve this, you can use the following code:
pythonIf Target.Address = "$B$3" Then Dim valueToCopy As Variant valueToCopy = ActiveSheet.Range("B1").Value Sheets("Job Request").Range("A1").Value = valueToCopy End IfThis code checks if the target address is equal to "3". If it is, it assigns the value of cell B1 in the active sheet to the variable
valueToCopy. Then, it sets the value of cell A1 in the "Job Request" sheet to the value ofvalueToCopy. Note that this code copies the value only, not the formatting or formulas.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.