![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: England
Posts: 212
|
I have this code to specify the lastrow, can someone help me with the code to specify a sheet in a different workbook.
lastrow = Sheets("Complete").Cells(Rows.Count, "B").End(xlUp).Row thanks Matt |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
Qualify it with the Workbooks reference. You may need to specify the path, but if the other workbook is open, the following should work. lastrow = Workbooks("My file.xls").Sheets("Complete").Cells(Rows.Count, "B").End(xlUp).Row The original reference can be made more complete by using ThisWorkbook. lastrow = ThisWorkbook.Sheets("Complete").Cells(Rows.Count, "B").End(xlUp).Row although that is not a requirement. Bye, Jay |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: England
Posts: 212
|
Thanks again for your help Jay
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|