PasteSpecial Issue

davidam

Active Member
Joined
May 28, 2010
Messages
497
Office Version
  1. 2021
Platform
  1. Windows
Hello Everyone,
I have the following code which I use to paste some data from the web onto a spreadsheet. (thisSheet is the working sheet, newSheet is a temporary book/sheet. I have copied the entire web page onto newSheet, then isolated the needed data with the "topRow, botRow" stuff.) It works fine except for one thing, it also pastes formatting and some pictures.
Code:
topRow = newSheet.Range("G1").End(xlDown).Row + 1
botRow = newSheet.Range("G500").End(xlUp).Row
Set copyRange = newSheet.Range("G" & topRow & ":" & "Z" & botRow)
pasteRow = thisSheet("Sheet1").Range("AA2999").End(xlUp).Row + 1
Set pasteCell = thisSheet.Range("AA" & pasteRow)
ThisWorkbook.Activate
copyRange.Copy pasteCell
newBook.Close False

I need to eliminate the formatting and pictures and just paste the values. I think I need to change the line:
Code:
copyRange.Copy pasteCell
but all my attempts have been somewhat disasterous. Any suggestions?
Thank you,
David
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Yes thanks, that works. One thing I notice is that each cell has the error message in the corner. When I click it it says that: the number is formattted as text (or preceeded by an apostrophe). With hundreds of cells, this is probably very inefficient. Is there a way to eliminate this?
 
Upvote 0
OK, solved the text issue with "Text to Columns" as documented elsewhere in the forum. Thanks!
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,513
Members
452,921
Latest member
BBQKING

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