Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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?

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 68
Default Please, somebody look at this code : (

GENIUS! That's what you are!

thanks for responding, even though I posted in the wrong forum.

:) :) :) :) :)
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2 Questions John Calder New Users to Excel 18 August 24th 06 04:17 AM
code not unique find latest date Barbara Wiseman Excel Discussion (Misc queries) 3 December 11th 05 08:50 AM
VLOOKUP for Zip Code Ranges JerseyJR Excel Worksheet Functions 2 September 6th 05 06:37 PM
Conform a total to a list of results? xmaveric Excel Discussion (Misc queries) 1 August 21st 05 07:22 PM
Macro for changing text to Proper Case JPriest Excel Worksheet Functions 3 August 8th 05 09:31 PM


All times are GMT +1. The time now is 09:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"