View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Please, somebody look at this code : (

Drop the .paste from that line and I'd change the order--just for ease of
reading.


LastRow = wsIr.Cells(Rows.Count, "I").End(xlUp).Row
Set MyRange = wsIr.Cells(LastRow, "I").Offset(1, -8)

With orgn.Sheets(2)
.Range("A1", .Cells.SpecialCells(xlCellTypeLastCell)).Copy _
Destination:=MyRange
End With



justme wrote:

Sub GetData()
Dim origin As String
Dim orgn As Workbook, dest As Workbook
Dim ws As Worksheet
Dim wsIr As Worksheet

Dim Firstrow As Long
Dim LastRow As Long
Dim Lrow As Long

Set wsIr = Sheets("INTLraw")

wsIr.Activate
Range("A1").Select

Application.ScreenUpdating = False
origin = Application.GetOpenFilename("Microsoft Office Excel
Files(*.xl*;*.xls;*.xla;*.xlm;*.xlc;*.xlw),*.xl*;* .xls;*.xla;*.xlm;*.xlc;*.xlw")
If origin = "False" Then Exit Sub
Workbooks.Open origin, 0, True
Set orgn = ActiveWorkbook
orgn.Activate
Sheets(2).Activate

Firstrow = ActiveSheet.UsedRange.Cells(1).Row
LastRow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1

With ActiveSheet
.DisplayPageBreaks = False
End With

With orgn.Sheets(2)
LastRow = wsIr.Cells(Rows.Count, "I").End(xlUp).Row
Set MyRange = wsIr.Cells(LastRow, "I").Offset(1, -8)
.Range("A1", .Cells.SpecialCells(xlCellTypeLastCell)).Copy
Destination:=MyRange.Paste
End With
WSI.Activate

End Sub

I am having problems with the line near the end reading ".Range("A1",......"

Causes run-time error: Object doesn't support this property or method.

Help?


--

Dave Peterson