Results 1 to 3 of 3

Insert Row at Variable Location

Threaded View

  1. #1
    Registered User
    Join Date
    01-17-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    67

    Insert Row at Variable Location

    Hi Folks,

    I had a quick question for something that should be simple but I can't figure it out.

    I have a column of sorted values, it goes

    A
    A
    A
    A
    A
    B
    B
    B
    B
    B

    and I want to insert a row to separate the A's from the B's. But there will be a random number of A's.

    I can figure out how to count where the A's end. But I can't figure out how to insert a row. Any suggestions? I tried the two below but they don't seem to work... Many thanks,

    The for section is counting the A's, and it works, it's what comes next that's giving me a headache!

    EDIT: Solved, it actualy was really simple. If anyone has the same problem, please see code below
    Dim test As Long
    
    test = 1
    
       For i = 1 To tempcount
            If Range("C" & i).Value = "A" Then
            forcount = forcount + 1
            End If
        Next
    
      Rows(tempcount).Insert
    Last edited by agentred; 12-03-2009 at 10:18 PM.

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