Hi jordan1214,
Try this:
Option Explicit
Sub Macro2()
'Written by Trebor76
'Visit my website www.excelguru.net.au
Dim varMyTabLen As Variant
Dim lngMyRow As Long
Dim rngCell As Range
Application.ScreenUpdating = False
For Each rngCell In Sheets("Info").Range("B2", Range("B" & Rows.Count).End(xlUp))
On Error Resume Next
varMyTabLen = Len(Sheets(CStr(rngCell)).Name)
If Err.Number = 0 Then
If WorksheetFunction.CountA(CStr(rngCell)) = 0 Then
lngMyRow = 2 'Default row number if there's no data. Change to suit.
Else
lngMyRow = Sheets(CStr(rngCell)).Range("A:P").Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
End If
Sheets(CStr(rngCell)).Range("A" & lngMyRow & ":P" & lngMyRow).Value = Sheets("Info").Range("A" & rngCell.Row & ":P" & rngCell.Row).Value
End If
Err.Clear
On Error GoTo 0
Next rngCell
Application.ScreenUpdating = True
MsgBox "Process is complete"
End Sub
Note, as there a space after each "One" in column B of the "Info" tab, these rows will not be transferred to the "One" tab as the names must be exact for the code to work.
Regards,
Robert
Bookmarks