Results 1 to 10 of 10

Selecting a column range based

Threaded View

  1. #1
    Registered User
    Join Date
    06-26-2009
    Location
    O.o
    MS-Off Ver
    Excel 2003
    Posts
    64

    Selecting a column range based

    Hi guys,

    Trying select a range from a point x in a column to the the last empty cell above it.

    I think I need another variable to count how many rows I have gone down but can't get my head quite around how to achieve this.

    As you can see in the sample book i am trying to quickly fill in the above rows in the column.

    Sub group_counter()
    
    Dim myrange As Range
    Dim n As Integer, mycounter As Integer, IntCounter As Integer
    
    Set myrange = ActiveSheet.Range("A2", Range("A" & Rows.Count).End(xlUp))
    n = 1
    
    IntCounter = myrange.Rows.Count - 1
    
    myrange.Select
    For mycounter = 0 To IntCounter
        
        
        If (myrange(mycounter + 1).Value = myrange(mycounter + 2).Value) And _
        (myrange(mycounter + 1).Offset(0, 9).Value <> myrange(mycounter + 2).Offset(0, 9).Value) Then
        n = n + 1
        
        ElseIf myrange(mycounter + 1).Value <> myrange(mycounter + 2).Value Then
        myrange(mycounter + 1).Offset(0, 3) = n
        'Range(Cells(mycounter + 1, "D"), x, "D").End(xlUp)).Select
        'selection.valule = n 
         n = 1
    
    End If
    Next
    End Sub

    Thanks in advance for your time and help!
    D
    Attached Files Attached Files
    Last edited by dems; 09-10-2010 at 07:29 AM.

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