PDA

View Full Version : Paste values copied from a webpage



robws8743
06-26-2014, 12:20 AM
I want to write a macro where I go to a webpage, copy two rows of six values, return to my worksheet and paste those values into and area where I make several calculations. I then want to copy and paste the results of the calculations into a cell adjacent to an item in one of three lists on the worksheet. My macro will paste the data but then halt with an error saying the paste special failed. I appreciate any help you can offer... I'm a novice at this but can see the power.
Tks

werafa
07-08-2014, 06:22 PM
use the macro recorder - then edit your code heavily.
test your code regularly and back-track if it breaks.
then search on the code you don't understand and you'll find lots of commentary on how to improve the recorded code.

snb
07-09-2014, 12:35 AM
Please post the code you have so far.

werafa
07-09-2014, 05:48 PM
Sub PasteHeatmap()
' PasteHeatmap Macro
On Error GoTo ErrorTrap
With ActiveSheet
.AutoFilterMode = False
.Cells(1, 1).Activate
.Cells.ClearContents
.Cells(1, 1).Select
.PasteSpecial Format:="Text", Link:=False, DisplayAsIcon:=False
.UsedRange
End With
Exit Sub
ErrorTrap:
MsgBox "Did you remember to hit 'copy'?"
End Sub

Activesheet is important here - I never use it willingly

werafa
07-09-2014, 05:49 PM
activesheet.usedrange is a handy trick to reset the used range property