Hi
I have a number of files which I am opening, manipulating and copying the result to a master workbook
I am attempting to use code like this
Is it posible to define the value of LastRow without making Master the active workbook?
Thanks
Robert
Hi
I have a number of files which I am opening, manipulating and copying the result to a master workbook
I am attempting to use code like this
Is it posible to define the value of LastRow without making Master the active workbook?
Thanks
Robert
Re: Find Last Row In Non-active Workbook
I've just thought, in your code you use EntireRegion, maybe you mean CurrentRegion or UsedRange.
Re: Find Last Row In Non-active Workbook
Hi Roy
thanks for your reply, you were quite right I did mean CurrentRegion. However I tried to adapt your code but it didn't work. Just to show where I am coming from here is some working code (with grateful acknowledgement to Dave Hawley, the originator of the basic code)
Workbooks.Add
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\My Documents\Filename.xls"
Set MWb = ActiveWorkbook
On Error Resume Next
Set Cwb = ThisWorkbook
With Application.FileSearch
.NewSearch
.LookIn = "F:\Payments\"
.FileType = msoFileTypeAllFiles
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Set Rwb = Workbooks.Open(.FoundFiles(i))
'another sub called here
R = ActiveCell.Row - 1
Set myRange = Range("A1", "E" & R)
myRange.Copy
MWb.Activate
R = ActiveCell.SpecialCells(xlCellTypeLastCell).Row + 1
Range("A" & R).Select
ActiveSheet.Paste
Rwb.Close
Display More
it was the last chunk, after the called routine had run, that I was hoping to streamline with my earlier effort.
Any comments would be appreciated
Regards
Robert
Don’t have an account yet? Register yourself now and be a part of our community!