Results 1 to 10 of 10

Scan through cells, and distribute to appropriate alpha sheets

Threaded View

  1. #1
    Registered User
    Join Date
    11-16-2011
    Location
    ND
    MS-Off Ver
    Excel 2003
    Posts
    8

    Scan through cells, and distribute to appropriate alpha sheets

    Please see this thread: http://www.excelforum.com/excel-prog...ml#post2644420

    The following code goes through thousands of rows in my sheet named "source" and copies and pastes the rows throughout alphabetically named sheets like "#s", "A", "B", etc., but what if I wanted them to begin on a different column in sheet "A" like column "G"?

    Sub copy_rows2()
    Dim last_source As Variant, RowNum As Variant, LeadChar As Variant, NewRow As Variant
    last_source = Sheets("source").UsedRange.Cells(Sheets("source").UsedRange.Cells.Count).Row
    For RowNum = 1 To last_source
        If Sheets("source").Columns("C").Rows(RowNum).Value <> "" Then
            LeadChar = Left(Sheets("source").Columns("c").Rows(RowNum).Value, 1)
            If IsNumeric(LeadChar) Then LeadChar = "#s"
            LeadChar = UCase(LeadChar) 'assumes sheet names are capital letters
            NewRow = 1
            Do While Application.WorksheetFunction.CountA(Sheets(LeadChar).Rows(NewRow)) <> 0
                NewRow = 1 + NewRow
            Loop
            Sheets("source").Columns("c").Rows(RowNum).EntireRow.Copy Destination:=Sheets(LeadChar).Columns(1).Rows(NewRow)
        End If
    Next RowNum
    End Sub
    Last edited by jessegpierce; 11-28-2011 at 11:47 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