PasteSpecial problem

  • Thread starter Domingos Junqueira / RJ
  • Start date
D

Domingos Junqueira / RJ

Excel 2003 under XP

I'm having problem with the code below, I want to use "Selection.PasteSpecial Paste:=xlPasteValues..." but the VBA doesn't accept it.
I want just the values to be paste and NO format.

Tx for any help!




--------------------------------------------------------------------------------

Sub ColetaDados()
Windows("download.asp").Visible = True
Range("I70").Select
Selection.End(xlUp).Select
Range(Selection, Selection.End(xlUp)).Select
Range(Selection, Selection.End(xlToLeft)).Select
If ActiveWindow.RangeSelection.Address = "$A$5:$I$8" Then
Range("A8:I8").Select
End If
Selection.Copy
Workbooks("download.asp").Close SaveChanges:=False
Worksheets("Plan1").Range("B3").Select
Selection.End(xlDown).Select
SendKeys String:="{DOWN}", Wait:=True

'The problem is here.

ActiveSheet.Paste

Selection.Interior.ColorIndex = xlNone
ActiveWindow.ScrollRow = 34
Range("L34").Select
End Sub
 
D

Dave Peterson

First, this is a plain text newsgroup. Please don't post in HTML/RTF.

Second, maybe...

Sub ColetaDados()
Dim DestCell as range

Windows("download.asp").Visible = True
Range("I70").Select
Selection.End(xlUp).Select
Range(Selection, Selection.End(xlUp)).Select
Range(Selection, Selection.End(xlToLeft)).Select
If ActiveWindow.RangeSelection.Address = "$A$5:$I$8" Then
Range("A8:I8").Select
End If
Selection.Copy

with Worksheets("Plan1")
set destcell = .range("b3").end(xldown).offset(1,0)
end with

destcell.pastespecial paste:=xlpastevalues

Workbooks("download.asp").Close SaveChanges:=False
End Sub
 
D

Domingos Junqueira / RJ

Sorry for the html,

Dave, I want to paste the selected range in another workbook, so I close
'download.asp' before pasting it. Unfortunately this code failed, could you
still help me?

Tx

Domingos Junqueira
 
D

Dave Peterson

Change this line:

with Worksheets("Plan1")
to
with workbooks("whateverthenameishere.xls").Worksheets("Plan1")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top