Sub Upload()
'Create Sheet
Sheets("00-1820080").Select
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Upload"
'Headings on "Upload" tab
Sheets("Upload").Select
Range("A1").Select
ActiveCell.FormulaR1C1 = "COMPANYID"
Range("B1").Select
ActiveCell.FormulaR1C1 = "COMPANY NAME"
Range("C1").Select
ActiveCell.FormulaR1C1 = "BACHNAME"
Range("d1").Select
ActiveCell.FormulaR1C1 = "JRNENTRY"
Range("e1").Select
ActiveCell.FormulaR1C1 = "TRXTYPE"
Range("f1").Select
ActiveCell.FormulaR1C1 = "REFERAN"
Range("g1").Select
ActiveCell.FormulaR1C1 = "GLACCTNUMB"
Range("h1").Select
ActiveCell.FormulaR1C1 = "ACCOUNTNAME"
Range("i1").Select
ActiveCell.FormulaR1C1 = "DEBIT"
Range("j1").Select
ActiveCell.FormulaR1C1 = "CREDIT"
Range("k1").Select
ActiveCell.FormulaR1C1 = "DATE"
Range("l1").Select
ActiveCell.FormulaR1C1 = "REVERSING DATE"
Range("m1").Select
ActiveCell.FormulaR1C1 = "DISTRIBUTIONREF"
Range("n1").Select
ActiveCell.FormulaR1C1 = "SQLNE"
Range("o1").Select
ActiveCell.FormulaR1C1 = "AA_AMOUNT"
Range("p1").Select
ActiveCell.FormulaR1C1 = "TRX_DIM"
Range("q1").Select
ActiveCell.FormulaR1C1 = "TRX_DIM_CODE"
Range("r1").Select
ActiveCell.FormulaR1C1 = "SUB_LOOKUP_ID"
Range("s1").Select
ActiveCell.FormulaR1C1 = "RDEBIT"
Range("t1").Select
ActiveCell.FormulaR1C1 = "RCREDIT"
'copy/paste numbers from recon to upload
Sheets("00-1820080").Select
ActiveSheet.Range("$A$1:$X$138").AutoFilter Field:=1, Criteria1:="CR"
'----------------------------------------------------------------------------------------TROUBLE IS WITH THE CODE BELOW IMMEDIATELY BELOW THIS LINE
'Look for "Current" copy and then Paste on Upload
Dim i As Integer, j As Integer, LR As Long
With Sheets("00-1820080")
For i = 1 To 12
If .Cells(1, i).Value Like "Current" Then
LR = .Cells(Rows.Count, i).End(xlUp).Row
j = j + 9
.Range(.Cells(2, i), .Cells(LR, i)).Copy Destination:=Sheets("Upload").Cells(2, j)
End If
Next i
End With
Sheets("00-1820080").Select
ActiveSheet.ShowAllData
'Take out CR to have the vendor names pasted on upload (REFERAN)
Sheets("00-1820080").Select
ActiveSheet.Range("$A$13:$T$763").AutoFilter Field:=1, _
Criteria1:="<>CR", _
Operator:=xlAnd
Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row).SpecialCells(xlCellTypeVisible).Copy _
Sheets("Upload").Range("F2")
'Change Numbers from negative to positive for Upload tab
Sheets("Upload").Select
Dim Lastrow As Integer
Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
For Each Cell In Range("I2:I" & Lastrow)
If Cell.Value < 0 Then
Cell.Value = Abs(Cell.Value)
End If
Next Cell
'Add ATECH (COMPANYID)
Finalrow = Cells(Rows.Count, "I").End(xlUp).Row
Range("A2:A" & Finalrow).Formula = "=FORM!$B$2"
Range("A2").Copy Destination:=Range("A2:A" & Finalrow)
'Add Amherst InsightLabs LLC (COMPANY NAME)
Finalrow = Cells(Rows.Count, "I").End(xlUp).Row
Range("B2:B" & Finalrow).Formula = "Amherst InsightLabs LLC"
Range("B2").Copy Destination:=Range("B2:B" & Finalrow)
'Add PREPAIDS (BACHNAME)
Finalrow = Cells(Rows.Count, "I").End(xlUp).Row
Range("C2:C" & Finalrow).Formula = "=FORM!$B$7"
Range("C2").Copy Destination:=Range("C2:C" & Finalrow)
'Add "1" (JRNENTRY)
Sheets("Upload").Select
Range("D2").Select
ActiveCell.FormulaR1C1 = "1"
LR = Range("I" & Rows.Count).End(xlUp).Row
Range("D2").AutoFill Destination:=Range("D2:D" & LR), Type:=xlFillSeries
'Add "0" (TRXTYPE)
Finalrow = Cells(Rows.Count, "I").End(xlUp).Row
Range("E2:E" & Finalrow).Formula = "=FORM!$B$5"
Range("E2").Copy Destination:=Range("E2:E" & Finalrow)
'Add (GLACCTNUMB)
Sheets("00-1820080").Select
ActiveSheet.ShowAllData
'Take out CR to have the GL Account number pasted on upload
Sheets("00-1820080").Select
ActiveSheet.Range("$A$13:$T$763").AutoFilter Field:=1, _
Criteria1:="<>CR", _
Operator:=xlAnd
Range("C2:C" & Cells(Rows.Count, "A").End(xlUp).Row).SpecialCells(xlCellTypeVisible).Copy _
Sheets("Upload").Range("G2")
'Add (ACCOUNTNAME)
Sheets("Upload").Select
Finalrow = Cells(Rows.Count, "I").End(xlUp).Row
Range("H2:H" & Finalrow).Formula = "=VLOOKUP(C[-1],ChartofAccounts!C[-7]:C[-6],2,0)"
Range("H2").Copy Destination:=Range("H2:H" & Finalrow)
'Add (CREDIT)
Finalrow = Cells(Rows.Count, "I").End(xlUp).Row
Range("J2:J" & Finalrow).Formula = "0"
Range("J2").Copy Destination:=Range("J2:J" & Finalrow)
'Add (DATE)
Finalrow = Cells(Rows.Count, "I").End(xlUp).Row
Range("K2:K" & Finalrow).Formula = "=FORM!$B$3"
Range("K2").Copy Destination:=Range("K2:K" & Finalrow)
'Take out CR to have the vendor names pasted on upload (REFERAN)
Sheets("00-1820080").Select
ActiveSheet.ShowAllData
Sheets("00-1820080").Select
ActiveSheet.Range("$A$13:$T$763").AutoFilter Field:=1, _
Criteria1:="<>CR", _
Operator:=xlAnd
Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row).SpecialCells(xlCellTypeVisible).Copy _
Sheets("Upload").Range("M2")
'(SQLNE) Fill Series Numbers 1,2,3,4,5...
Sheets("Upload").Select
Range("N2").Select
ActiveCell.FormulaR1C1 = "1"
LR = Range("I" & Rows.Count).End(xlUp).Row
Range("N2").AutoFill Destination:=Range("N2:N" & LR), Type:=xlFillSeries
'(RDEBIT) AND (RCREDIT) Column S
Dim LS As Long
Range("S2").Select
ActiveCell.FormulaR1C1 = "=ROUND(RC[-10],2)"
LR = Range("I" & Rows.Count).End(xlUp).Row
Range("S2").AutoFill Destination:=Range("S2:S" & LR), Type:=xlFillSeries
Dim LT As Long
Range("t2").Select
ActiveCell.FormulaR1C1 = "=ROUND(RC[-10],2)"
LR = Range("I" & Rows.Count).End(xlUp).Row
Range("t2").AutoFill Destination:=Range("t2:t" & LR), Type:=xlFillSeries
'Combine
Call newother_
'Negative to POSITIVE
Sheets("Upload").Select
Dim Lastrow1 As Integer
Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
For Each Cell In Range("I2:I" & Lastrow)
If Cell.Value < 0 Then
Cell.Value = Abs(Cell.Value)
End If
Next Cell
'(SQLNE) Fill Series Numbers 1,2,3,4,5...
Sheets("Upload").Select
Range("N2").Select
ActiveCell.FormulaR1C1 = "1"
LR = Range("I" & Rows.Count).End(xlUp).Row
Range("N2").AutoFill Destination:=Range("N2:N" & LR), Type:=xlFillSeries
'FOrmatting Upload tab
Cells.Select
Cells.EntireColumn.AutoFit
Columns("H:H").Select
Selection.Copy
Columns("F:F").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
Columns("M:M").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
' (BACHNAME)
Finalrow = Cells(Rows.Count, "I").End(xlUp).Row
Range("A2:A" & Finalrow).Formula = "=FORM!$B$2"
Range("A2").Copy Destination:=Range("A2:A" & Finalrow)
'DELETE UPLOAD2
Application.DisplayAlerts = False
Sheets("Upload2").Select
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
End Sub
Bookmarks