I have 7 macros that I have combined to accomplish what I am trying to do. When ran on the original spreadsheet they were created on, it works flawlessly. When I copied the macros into the new spreadsheet for this month (it is updated quantities of different products for an order.), there were some problems. Header column is different products to be ordered, rows begin with a location name followed by order quantities of said products. Here is a quick synopsis on what happens:
macro 1: creates a new tab to be named each location name in column A
macro 2: copies the top 2 rows of product information and pastes them onto each new tab
macro 3: takes each individual location and copies just that row onto the corresponding tab
* this is where there is a problem. The first location - named DC's - will not copy onto its tab. Even if I adjust which row this location is in, it still will not copy. There are 90 locations total and this is the only one. This location copied fine on the original spreadsheet.
This is my code for macro 3:
Sub Run_Third()
Application.ScreenUpdating = False
Dim rs As Worksheet
Set rs = Worksheets("DATA")
For r = 1 To rs.Range("A" & Rows.Count).End(xlUp).Row
wsName = rs.Cells(r, "A")
If WorksheetFunction.IsErr(Evaluate("'" & wsName & "'!A1")) = "False" Then
wr = Worksheets(wsName).Range("A" & Rows.Count).End(xlUp).Row + 2
rs.Rows(r).Copy Destination:=Worksheets(wsName).Range("A" & wr)
End If
Next r
Application.ScreenUpdating = True
End Sub
macro 1: creates a new tab to be named each location name in column A
macro 2: copies the top 2 rows of product information and pastes them onto each new tab
macro 3: takes each individual location and copies just that row onto the corresponding tab
* this is where there is a problem. The first location - named DC's - will not copy onto its tab. Even if I adjust which row this location is in, it still will not copy. There are 90 locations total and this is the only one. This location copied fine on the original spreadsheet.
This is my code for macro 3:
Sub Run_Third()
Application.ScreenUpdating = False
Dim rs As Worksheet
Set rs = Worksheets("DATA")
For r = 1 To rs.Range("A" & Rows.Count).End(xlUp).Row
wsName = rs.Cells(r, "A")
If WorksheetFunction.IsErr(Evaluate("'" & wsName & "'!A1")) = "False" Then
wr = Worksheets(wsName).Range("A" & Rows.Count).End(xlUp).Row + 2
rs.Rows(r).Copy Destination:=Worksheets(wsName).Range("A" & wr)
End If
Next r
Application.ScreenUpdating = True
End Sub