VBA code to copy text from a cell to different sheet with click button

Jyotirmaya

Board Regular
Joined
Dec 2, 2015
Messages
204
Office Version
  1. 2019
Platform
  1. Windows
I dont have much knowledge about VBA codes

I have a particular cell B19 where I put texts and the cell text changes repeatedly according to the input. I want to copy the text from the B19 to other sheet named "Print" when I click the click button.

for example, now in the cell B19 the text is Ram, if i click the button the text Ram will be saved on B1 of Sheet named "Print" then subsequently I put text Ram2020 and will click the button then the text will be saved on B2 of "Print" sheet.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
No its more than 100 daily, If that cell was constant I would have referred that using =Data!B19 in the "Print" sheet, but as the data are changing, i cant use that, Presently I am copying the text of B19 and saving that in cell B1,B2,B3 subsequently.

I want a code something like that........which will automatically copy the cell text to the next cell with click button

Sub Button1_Click()
Range("A3:A3").Copy Destination:=Cells(ActiveCell.Row + 1, 1)
End Sub
 
Upvote 0
I got the solution like this

Sub Button1_Click()
Range("A1:A5").Copy
Sheet2.Range("A" & Rows.Count).End(3)(2).PasteSpecial xlPasteValues
Sheet2.Select
Application.CutCopyMode = False
End Sub
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,215,235
Messages
6,123,786
Members
449,125
Latest member
shreyash11

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