Simple code changing required VBA macro excel to copy paste cells

Jyotirmaya

Board Regular
Joined
Dec 2, 2015
Messages
205
Office Version
  1. 2019
Platform
  1. Windows
Sub Button3_Click()
Range("B19", "B22").Copy
Sheet4.Range("B" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
Sheet4.Select
Application.CutCopyMode = False
End Sub


I need only to copy the value of B19 and B22 on "Sheet4" B & C Cells respectively but when I use the above formula, it copies entire rows from B19 to B22 and pastes vertically in B2,B3,B4,B5.

I want the code to copy only value of B19 & B22 and value will be posted in B & C columns automatically to the next row and so on.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
You can't copy non-contiguous cells. Copy/Paste the two cells one at a time.

BTW:
Range("B19","B22") is the range B19:B22
Range("B19,B22") is the two cells, B19 and B22
 
Upvote 0
Thanks Joe thats working but the text is copied in B2 & B3 I want the copied cell in B2 C2 then B3 C3 so on.
 
Upvote 0
Thanks Joe thats working but the text is copied in B2 & B3 I want the copied cell in B2 C2 then B3 C3 so on.
Then change your code to put the copied cell into the correct cell.
 
Upvote 0
I dont have much knowledge about coding, kindly let me know what to change in the code

Sub Button3_Click()
Range("B19,B22").Copy
Sheet4.Range("B" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
Sheet4.Select
Application.CutCopyMode = False
End Sub

I think in the green line there should be some modification to paste the cell value in B2 c2 B3 c3 respectively. kindly let me know
 
Upvote 0
I dont have much knowledge about coding, kindly let me know what to change in the code

Sub Button3_Click()
Range("B19,B22").Copy
Sheet4.Range("B" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
Sheet4.Select
Application.CutCopyMode = False
End Sub

I think in the green line there should be some modification to paste the cell value in B2 c2 B3 c3 respectively. kindly let me know


Does this do what you want?
Code:
Sub Button3_Click()
Range("B19").Copy
Sheet4.Range("B" & Rows.Count).End(xlUp)(2).PasteSpecial xlPasteValues
Range("B22").Copy
Sheet4.Range("C" & Rows.Count).End(xlUp)(2).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Sheet4.Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,719
Messages
6,174,089
Members
452,542
Latest member
Bricklin

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