Copy and Paste value from one workbook to another

hajiali

Well-known Member
Joined
Sep 8, 2018
Messages
624
Office Version
  1. 2016
Platform
  1. Windows
VBA Code:
Sub PullFinalBidData()
  Dim wb As Workbook, fullpath As String
  Dim wt As Worksheet
  Set wt = Sheets("BID")
  With Application.FileDialog(msoFileDialogFilePicker)
    .AllowMultiSelect = False
    .Filters.Add "Excel Files", "*.xlsm", 1
    If .Show <> -1 Then Exit Sub
    fullpath = .SelectedItems.Item(1)
    Set wb = Workbooks.Open(fullpath)
    wb.Sheets("RA Print").Range("E5:S303").Copy ThisWorkbook.Sheets("TOOL DATA").Range("B3")
    wb.Sheets("RA Print").Range("E304:S604").Copy ThisWorkbook.Sheets("TOOL DATA").Range("B303")
    wb.Close False
  End With
End Sub

Using the above code it copies the data but uses just paste. How would I be able to make this paste Value.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Like this

VBA Code:
Sub PullFinalBidData2()
  Dim wb As Workbook, fullpath As String
  Dim wt As Worksheet
  Set wt = Sheets("BID")
  With Application.FileDialog(msoFileDialogFilePicker)
    .AllowMultiSelect = False
    .Filters.Add "Excel Files", "*.xlsm", 1
    If .Show <> -1 Then Exit Sub
    fullpath = .SelectedItems.Item(1)
    Set wb = Workbooks.Open(fullpath)
    wb.Sheets("RA Print").Range("E5:S303").Copy
    ThisWorkbook.Sheets("TOOL DATA").Range("B3").PasteSpecial xlPasteValues
    wb.Sheets("RA Print").Range("E304:S604").Copy
    ThisWorkbook.Sheets("TOOL DATA").Range("B303").PasteSpecial xlPasteValues
    wb.Close False
  End With
End Sub
 
Upvote 0
Thanks JLGWhiz that works great.

I am getting the Microsoft Excel Message about "There is a large amount of information on the clipboard. Do you want to be able to paste this information into another program Later? with option Yes No and Cancel.

Is there a way to prevent that message to appering?
 
Upvote 0
Rich (BB code):
 ThisWorkbook.Sheets("TOOL DATA").Range("B303").PasteSpecial xlPasteValues
 Application.CutCopyMode = False
  wb.Close False
add the line in blue as shown. That should clear the clipboard.
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,078
Latest member
skydd

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