Searching for a code to add that copy's value only.

geno32080

Board Regular
Joined
Jan 23, 2020
Messages
107
Office Version
  1. 2013
Platform
  1. Windows
I'm searching for a code to add to this that would paste the values only. Just data. dates, names client id's etc.
Below is the code that is working, except I need it t paste values only. It over writes the background color and the cells borders of the ("jax") Worksheet.
Any ideas?
Thanks for taking the time.

Set sourceworkbook = Workbooks.Open("D:\JEN FOLDER\IMPORT\Jacksonville.csv")
sourceworkbook.Sheets("Jacksonville").Range("A3:S98").Copy ThisWorkbook.Worksheets("jax").Range("B9:T98")
sourceworkbook.Close
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Try:
VBA Code:
Set sourceworkbook = Workbooks.Open("D:\JEN FOLDER\IMPORT\Jacksonville.csv")
sourceworkbook.Sheets("Jacksonville").Range("A3:S98").Copy
ThisWorkbook.Worksheets("jax").Range("B9:T98").PasteSpecial xlPasteValues
sourceworkbook.Close
 
Upvote 0
Try:
VBA Code:
Set sourceworkbook = Workbooks.Open("D:\JEN FOLDER\IMPORT\Jacksonville.csv")
sourceworkbook.Sheets("Jacksonville").Range("A3:S98").Copy
ThisWorkbook.Worksheets("jax").Range("B9:T98").PasteSpecial xlPasteValues
sourceworkbook.Close
When I run that code it brings up a box stating "There is a large amount of information on the clipboard," and so on..
I can click no not to save it, and it does copy just the values. The code I'm using has 7 other cities that go with it.
Any other ideas?
 
Upvote 0
Is the data for each city in its own separate file? If so, are the 7 files all in the same folder? Are they the only files in that folder?
 
Upvote 0
Is the data for each city in its own separate file? If so, are the 7 files all in the same folder? Are they the only files in that folder?
Yes all the files are in the same folder, and the only ones. I found a cure, With the help of JohnnyL. Below is the fix, the 4th line of code took care of it.
Thank you for your contribution.


Set sourceworkbook = Workbooks.Open("D:\JEN FOLDER\IMPORT\Jacksonville.csv")
sourceworkbook.Sheets("Jacksonville").Range("A3:S98").Copy
ThisWorkbook.Worksheets("jax").Range("B9").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
sourceworkbook.Close
 
Upvote 0
Solution
You are very welcome. :)
 
Upvote 0

Forum statistics

Threads
1,215,695
Messages
6,126,263
Members
449,307
Latest member
Andile

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