+ Reply to Thread
Results 1 to 13 of 13

select A2 down +1

  1. #1
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    select A2 down +1

    Hi,

    I have the following code to select a2 and go down:

    Please Login or Register  to view this content.
    I would like to do one more cell down after that?
    What do I have to add?

    Many Thanks

    greekboyuk

  2. #2
    Forum Contributor
    Join Date
    08-19-2010
    Location
    UK.
    MS-Off Ver
    Excel 2007
    Posts
    142

    re: select A2 down +1

    Range("A2").Select
    Selection.End(xlDown).Offset(1, 0).Select

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile re: select A2 down +1

    Mayweed

    Please use code tags.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    But ...

    Just taking Mayweed's answer a stage further we can avoid the use of unnecessary "Selects", which slows down execution, thus :
    Please Login or Register  to view this content.
    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  4. #4
    Forum Contributor
    Join Date
    08-19-2010
    Location
    UK.
    MS-Off Ver
    Excel 2007
    Posts
    142

    re: select A2 down +1

    Ooops! Sorry about that.

  5. #5
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    re: select A2 down +1

    Thanks Dominic, that's great. Mayweed, thanks as well. Is there a way to use similar concept when copying the data. For example I would like to copy data from A2:W2 and all the way down. If there are two or more rows filled with data it is fine as it copies only the data, however if only row2 contains data, it copies 65000cells?
    How could I prevent this please?

    Many Thanks for your contributions much appreciated

    Regards

    greekboyuk

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    re: select A2 down +1

    This perhaps?
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    re: select A2 down +1

    ]Hi Stephen,

    Thank you for your help. I have created the following code:

    Please Login or Register  to view this content.

    Now if test sheet is blank it copies my column headers. How could we prevent this please? If there is no data simply do not bring it back, go to next workbook?

    Many Thanks

  8. #8
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    re: select A2 down +1

    Not tested but see if this works. You may have to change the sheet names.
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    re: select A2 down +1

    Hi stephen

    thank you again for your help. For some reasons now it highlight the Used ranged line.

    Please Login or Register  to view this content.
    Sub stops.

    why this is happening??

    Many thanks

    greekboyuk

  10. #10
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    re: select A2 down +1

    What happens? Does it error? If you only have one row of data there is nothing to do.

  11. #11
    Forum Contributor
    Join Date
    08-19-2010
    Location
    UK.
    MS-Off Ver
    Excel 2007
    Posts
    142

    re: select A2 down +1

    Two files attached... might help?
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    Re: select A2 down +1

    Hi mayweed,

    Thank you for your help,
    I tested your attachments and they dont function the way that I wanted them. I would like the first row of the test data not to be copied.
    Also, when test workbook is empty (ignore row1) then the msg is displayed which is great however the test workbook stays open and it doesn't close.

    Any ideas please?

    Many Thanks

    greekboyuk

  13. #13
    Forum Contributor
    Join Date
    08-19-2010
    Location
    UK.
    MS-Off Ver
    Excel 2007
    Posts
    142

    Re: select A2 down +1

    Try the attached files.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1