+ Reply to Thread
Results 1 to 7 of 7

Selecting certain rows

Hybrid View

daviddcosta1 Selecting certain rows 09-02-2013, 07:44 AM
sbabu16 Re: Selecting certain rows 09-02-2013, 08:01 AM
Richard Buttrey Re: Selecting certain rows 09-02-2013, 08:20 AM
Richard Buttrey Re: Selecting certain rows 09-02-2013, 08:04 AM
AB33 Re: Selecting certain rows 09-02-2013, 08:15 AM
AB33 Re: Selecting certain rows 09-02-2013, 08:28 AM
daviddcosta1 Re: Selecting certain rows 09-02-2013, 09:56 AM
  1. #1
    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,

    Range("B6:B160").Select
        Selection.Copy
    or, u can use. this will select the cells from B6 until it finds the nonblank cell in the sheet.

        Sub try()
          
        
        Dim rLastCol As Range
         
        Range("B6").Select
        Set rLastCol = Cells.Find(What:="*", After:=[A1], _
        SearchOrder:=xlByColumns, _
        SearchDirection:=xlPrevious)
         
        Application.Goto Range(ActiveCell, rLastCol)
        End Sub
    Last edited by sbabu16; 09-02-2013 at 08:05 AM.
    Thanks
    Babu.S

  2. #2
    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

    Sub CopyRows()
        Dim x As Long
        x = InputBox("Enter the number of columns to copy") - 1
        Range("B6:B150").AutoFilter Field:=1, Criteria1:="<>"
        Range(Range("B6:B150"), Range("B6:B150").Offset(0, x)).SpecialCells(xlCellTypeVisible).Copy
        Range("myrange").PasteSpecial (xlPasteValues)
    End Sub
    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.

+ 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