Copy data from two cells to another tab

elsg

Active Member
Joined
Mar 16, 2013
Messages
295
Hi.
I am trying to copy two cells (B4) and (F23) tab ("Orig") and paste values ​​tab ("Dest") but always beneath the cells of Column A and Column B
tab ("Dest")
Code:
Private Sub Gravar_Click()
 With Worksheets("Orig")
    With .Range(Cells(4, 2), Cells(23, 6))
    .Copy
    End With
 End With
 Worksheets("Dest").[A65536].End(xlUp)(2).PasteSpecial Paste:=xlValues
 'Sheets("Orig").Range(Cells(4, 2), Cells(23, 6)).Copy
 'Worksheets("Dest").[A65536].End(xlUp)(2).PasteSpecial Paste:=xlValues
End Sub
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Maybe easier to just place the values in your target cells:
Code:
Private Sub Gravar_Click()
Dim lR As Long
lR = Worksheets("Dest").[A65536].End(xlUp)
Worksheets("Dest").Range("A" & lR).Value = Worksheets("Orig").Range("B4").Value
Worksheets("Dest").Range("B" & lR).Value = Worksheets("Orig").Range("F23").Value
End Sub
 
Upvote 0
I tried to hit my mistakes here, but generated another error
Run-time error '13 ':
Type mismatch
this line turns yellow
Code:
[COLOR=#333333]lR = Worksheets("Dest").[A65536].End(xlUp)[/COLOR]
 
Upvote 0
I tried to hit my mistakes here, but generated another error

this line turns yellow
Code:
[COLOR=#333333]lR = Worksheets("Dest").[A65536].End(xlUp)[/COLOR]
Change that line to this:
Rich (BB code):
lR = Worksheets("Dest").[A65536].End(xlUp).Row+1
 
Last edited:
Upvote 0
Hi
solved the problem of the error, but I need to click again the data
cells go low.
example
Every time I click
A2 B2
A3 B3
A4 B4
A5 B5
A6 B6
A7 B7
A8 B8
A9 B9
and so on

Thanks
 
Upvote 0
Hi
solved the problem of the error, but I need to click again the data
cells go low.
example
Every time I click
A2 B2
A3 B3
A4 B4
A5 B5
A6 B6
A7 B7
A8 B8
A9 B9
and so on

Thanks
Sorry, but I don't understand what you mean by the data cells go low. Each time you run the macro it will add entries to Column A & B in the first empty row below the last filled cell in column A. If that's not what you want, please provide more detail on what you want the result of running the macro to be.
 
Upvote 0

Forum statistics

Threads
1,203,060
Messages
6,053,303
Members
444,650
Latest member
bookendinSA

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