Good morning Guys,
I Have zero knowledge about coding but for my job I get questions about improving stuff.
I have found many things that I copy pasted and eventually got what I wanted except my file would save "In a specific folder on my computer" where I wanted to save the file in the General origin of the excel file no matter what computer it was in. I found a code that I think would do that so I removed the last part of the code and placed the new one in.
Now I am getting this Next for Without.
Can anyone look at the thing and fix it ?
I think the error must be in the last 10 lines as everything was working fine before I got there.
I Have zero knowledge about coding but for my job I get questions about improving stuff.
I have found many things that I copy pasted and eventually got what I wanted except my file would save "In a specific folder on my computer" where I wanted to save the file in the General origin of the excel file no matter what computer it was in. I found a code that I think would do that so I removed the last part of the code and placed the new one in.
Now I am getting this Next for Without.
Can anyone look at the thing and fix it ?
I think the error must be in the last 10 lines as everything was working fine before I got there.
VBA Code:
Sub Test()
'
' Test Macro
'
'
Columns("A:A").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("I:I").Select
Selection.Delete Shift:=xlToLeft
Columns("G:G").Select
Selection.Delete Shift:=xlToLeft
Columns("E:E").Select
Selection.Delete Shift:=xlToLeft
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
Columns("E:E").Select
Selection.Cut
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Columns("D:D").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("AxTable1[[#Headers],[Column1]]").Select
ActiveCell.FormulaR1C1 = "Location"
Columns("E:E").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("AxTable1[[#Headers],[Column1]]").Select
ActiveCell.FormulaR1C1 = "Sub Location"
Range("AxTable1[[#Headers],[Quantity]]").Select
Selection.Copy
Range("H1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Date"
Range("D2").Select
Application.CutCopyMode = False
Range("B1").Select
Columns("H:H").Select
Selection.NumberFormat = "m/d/yyyy"
Range("H2").Select
ActiveCell.FormulaR1C1 = "=IF(COUNTA(R2C[-1]:R100C[-1])>0,TODAY(),0)"
Range("A1").Select
ActiveCell.FormulaR1C1 = "PO"
Range("A1").Select
ActiveCell.FormulaR1C1 = "PO"
curUser = ActiveCell.Value
msg = InputBox("Please enter PO # for: " & curUser, "PO")
If msg <> "" Then
Range("A2").Select
ActiveCell.Value = msg
Range("A2").Select
Selection.AutoFill Destination:=Range("A2:A100"), Type:=xlFillDefault
Range("A2:A100").Select
ThisWorkbook.VBProject.VBE.MainWindow.Visible = False
End If
Columns("B:B").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
Range("A2:I2").Select
ActiveWindow.SmallScroll Down:=81
Range("A2:I100").Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-12
Columns("H:H").ColumnWidth = 10.09
Columns("I:I").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Cells.Select
Selection.NumberFormat = "General"
ActiveWindow.SmallScroll Down:=200
Dim Fpath As String
Fpath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each WS In ThisWorkbook.Sheets
WS.Copy
Application.ActiveWorkbook.SaveAs Filename:=Fpath & "\" & WS.Name & ".xlsx", FileFormat:=xlText, CreateBackup:=False
Range("D10").Select
ActiveWindow.Close
End Sub
Last edited by a moderator: