+ Reply to Thread
Results 1 to 7 of 7

Selecting certain rows

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Post Selecting certain rows

    Hi All,

    I am currently in the process of streamlining some VBA code which I obtained via record macro and was wondering if I someone would be able to point me in the right direction.

    I want to select cells from B6:B150 then copy and paste to another location. This process is repeated for over 20 columns (e.g. D6:E150, F6:F150 etc).
    As the there are gaps inbetween rows 6 -150 (for formatting), I have this clumsy code which repeats the below multiple times until it gets to row 150:
    Please Login or Register  to view this content.
    Is there a easier way of selecting these rows?
    Thanks for your help.
    Last edited by daviddcosta1; 09-02-2013 at 09:57 AM.

  2. #2
    Registered User
    Join Date
    05-21-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Selecting certain rows

    Hi,

    You can use,

    Please Login or Register  to view this content.
    or, u can use. this will select the cells from B6 until it finds the nonblank cell in the sheet.

    Please Login or Register  to view this content.
    Last edited by sbabu16; 09-02-2013 at 08:05 AM.
    Thanks
    Babu.S

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Selecting certain rows

    Hi,

    One way

    Name the cell location in which you want to paste the results as 'myrange' then run the following macro
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Selecting certain rows

    Change these followings to suit your needs:

    ActiveSheet is the source of the data

    Sheets("Sheet2") is the destination sheet

    Range("B" :Will copy in to next empty column B
    Please Login or Register  to view this content.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Selecting certain rows

    ...and if I misinterpreted the original perhaps. Create the range name myrange as before

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Selecting certain rows

    I may have also misinterpreted the requirements.
    If you going from B to C with not step over, change this line in to 1
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-19-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Selecting certain rows

    Hi All,

    Thanks so much for the quick replies. I've played around with the responses and have been able to adapt AB33's reply to help clean up my code.

    Dave

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Error When Selecting Sheet then Selecting Range
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-08-2012, 04:11 AM
  2. [SOLVED] Selecting last row
    By mhayli in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2006, 05:30 AM
  3. Selecting
    By Viktor Ygdorff in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2006, 08:30 AM
  4. Selecting last row?
    By edward0380 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2006, 03:45 PM
  5. Selecting every 3rd row ???
    By Larry in forum Excel General
    Replies: 1
    Last Post: 03-17-2005, 09:06 PM

Tags for this Thread

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