Copying data and formula from one workbook to another

tmd63

New Member
Joined
Feb 21, 2014
Messages
40
Office Version
  1. 2013
  2. 2003 or older
Platform
  1. Windows
I am trying to copy from a workbook that has a single sheet called 'Lookup' to my local workbook using vba in excel2003 (for macros issue).
When I use the code below, I get the entire sheet data, but not the formula is a couple of columns.

Code:
Workbooks.Open ("http://******.com/Shared%20Documents/Lookup.xls")

    LastRow = ActiveSheet.Cells.Find("*", , xlFormulas, xlPart, xlByRows, xlPrevious).Row
    ActiveSheet.Range("A1:M" & LastRow).Select
    Selection.Copy
    
    Application.DisplayAlerts = False
    
    ActiveWorkbook.Close
    
    Worksheets("Lookup").Select
    ActiveSheet.Range("A1").Select
    Worksheets("Lookup").Paste

How can I copy the formula as well as the data?
 
Last edited:

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.
From the top of my head - formulas come across with a pastespecial??

Code:
Worksheets("Lookup").PasteSpecial Paste:=xlPasteFormulas
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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