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
Bookmarks