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:
codeIf Target.Address = "$B$3" Then Dim copyValue As Variant copyValue = ActiveSheet.Range("B2").Value Sheets("Job Request").Activate ActiveSheet.Range("A1").Value = copyValue End IfHere, the value of cell B2 from the active sheet is assigned to the
copyValuevariable using theValueproperty. Then, the code activates the "Job Request" worksheet and assigns the value ofcopyValueto cell A1 using theValueproperty.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.