storemannequin
Board Regular
- Joined
- May 29, 2010
- Messages
- 108
I keep getting an error when I'm trying to save each new workbook to the original/activeworkbooks file path. I don't see why:
Code:
Sub WeeklyNotification()
Application.ScreenUpdating = False
Set ActveWb = ActiveWorkbook
Set ActveWs = ActveWb.ActiveSheet
FnlRw = ActveWs.Cells(Rows.Count, 1).End(xlUp).Row
FnlCol = ActveWs.Cells(1, Columns.Count).End(xlToLeft).Column
For i = 2 To FnlRw
With ActveWs.Cells(i, 1)
ThisPln = ActveWs.Cells(i, 1).Value
ThisNme = ActveWs.Cells(i, 2).Value
Set SlsWb = Workbooks.Add(template:=xlWBATWorksheet)
Set SlsWs = SlsWb.Worksheets(1)
ActveWs.Range("A1").CurrentRegion.Rows(1).Copy Destination:=SlsWs.Range("A1")
ActveWs.Cells(i, 1).Resize(, FnlCol).Copy Destination:=SlsWs.Cells(2, 1)
SlsWs.Name = "UOM Diff"
End With
FN = ThisNme & " Discontinued Item List " & Date & ".xlsx"
FP = ActveWb.Path & Application.PathSeparator
SlsWb.SaveAs Filename:=FP & FN
SlsWb.Close savechanges:=False
Next i
End Sub