Results 1 to 3 of 3

Thread: selecting rows

  1. #1
    Board Regular
    Join Date
    Mar 2016
    Posts
    1,179
    Post Thanks / Like
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Default selecting rows

    Hi
    The code below sometime works and some other does not. Specially when I change worksheets(1) to worksheets(2) but anyway now it does not work and I have 2 sheets in this workbook. Thank you so much.

    Code:
    Sub myrow()
        Workbooks(1).Worksheets(1).Rows(2).Select
    End Sub

  2. #2
    Board Regular BlakeSkate's Avatar
    Join Date
    Jan 2015
    Posts
    124
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: selecting rows

    Quote Originally Posted by lezawang View Post
    Hi
    The code below sometime works and some other does not. Specially when I change worksheets(1) to worksheets(2) but anyway now it does not work and I have 2 sheets in this workbook. Thank you so much.

    Code:
    Sub myrow()
        Workbooks(1).Worksheets(1).Rows(2).Select
    End Sub
    you can try this workaround
    Code:
    Sub myrow()
        Workbooks(1).Worksheets(2).Select
        ActiveSheet.Rows(2).Select
    End Sub

  3. #3
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    20,610
    Post Thanks / Like
    Mentioned
    331 Post(s)
    Tagged
    35 Thread(s)

    Default Re: selecting rows

    If workbooks(1) is not the active workbook you will need
    Code:
       Workbooks(1).Activate
       Worksheets(1).Select
       Rows(2).Select
    Last edited by Fluff; Apr 15th, 2019 at 01:02 PM.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 2003 & 2013 on Win 7

Some videos you may like

User Tag List

Tags for this Thread

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
  •