Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Specifying sheets in a different workbook

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    England
    Posts
    212
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-17 08:23, Matt wrote:
    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
    Hi Matt,

    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. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    England
    Posts
    212
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks again for your help Jay

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •