Copy cell to another worksheet (destination is mentioned in a cell)

Sumithdbm

New Member
Joined
Mar 24, 2021
Messages
5
Office Version
  1. 2013
Platform
  1. Windows
Hi, I am new to excel VBA. for a project i need to do something similar to below using a button click.

I have data on sheet1 and I need to copy data on sheet1 cell A1 to sheet2 Cell A3 (destination cell range "A3"mentioned in the Sheet1 cell D1). If i change cell address in D1 to A4, Data should copy to sheet2 Cell A4.

Thank You.
 

Attachments

  • example.JPG
    example.JPG
    19.9 KB · Views: 6

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi
try
VBA Code:
Sub test()
    Sheets("sheet1").Range("a1").Copy Sheets("sheet2").Range(Sheets("sheet1").Range("d1"))
End Sub
 
Upvote 0
You are welcome
And thank you for the feedback
Be happy & safe
 
Upvote 0
VBA Code:
Sub test()
    Sheets("sheet1").Range("a1").Copy
    Sheets("sheet2").Range(Sheets("sheet1").Range("d1")).PasteSpecial Paste:=xlPasteValues
End Sub

And how to paste data in selected cell as value
VBA Code:
Selection.PasteSpecial Paste:=xlPasteValues
 
Upvote 0
VBA Code:
Sub test()
    Sheets("sheet1").Range("a1").Copy
    Sheets("sheet2").Range(Sheets("sheet1").Range("d1")).PasteSpecial Paste:=xlPasteValues
End Sub


VBA Code:
Selection.PasteSpecial Paste:=xlPasteValues
Thanks again. Perfectly match with my project.
 
Upvote 0
You are welcome
And thank you for the feedback
Be happy & safe
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,458
Members
449,085
Latest member
ExcelError

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top