View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
justme justme is offline
external usenet poster
 
Posts: 68
Default Please, somebody look at this code : (

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?