How can i copy F14:F19, J14:J21...............

alibax

New Member
Joined
Dec 12, 2004
Messages
9
H!... guys... i have a vlookup table, which displays data, and i would like the data displayed by Vlookup to be copied to another sheet. I have to copy sheet 3 range "F14:F19, J14:J21" which is vlooktable to sheet7, range "A11:N12".... my VBA code dont seem to work, it cant copy data retrived via vlookup...
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,456
Hi,
The range given here doesn't exactly match the range mentioned in your PM, but you might want to give this a shot. It was written for the ranges in your PM so it may need a little tweaking...
Code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Range("F14:F19").Copy
If Sheet7.Range("A12") = "" Then
    Sheet7.Range("A12").PasteSpecial Paste:=xlValues, Transpose:=True
    Sheet3.Range("J14:J20").Copy
    Sheet7.Range("G12").PasteSpecial Paste:=xlValues, Transpose:=True
Else:
    Sheet7.Range("A65536").End(xlUp)(2, 1).PasteSpecial Paste:=xlValues, Transpose:=True
    Sheet3.Range("J14:J20").Copy
    Sheet7.Range("G65536").End(xlUp)(2, 1).PasteSpecial Paste:=xlValues, Transpose:=True
End If
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Am I correct in understanding what it is you're after here?
Dan
 

alibax

New Member
Joined
Dec 12, 2004
Messages
9
Thanks a lot. It works exactly as I wanted. I would like to know why didn't the last code work, is it because of Vlookup?











Cheers
 

Forum statistics

Threads
1,148,393
Messages
5,746,441
Members
424,019
Latest member
dpteo

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
Top