I am trying to assign a unique number to each row composed of 4 data elements provided via input box and a portion of an existing value in a related cell. I have tried a couple of different options and keep hitting a wall. The string below is long but I hit a snag towards the bottom in green where i have two formulas both attempting to preform the same action.
Sub Voucher_Number()
'
' Voucher_Number Macro
' Insert column and concatenate
'
' Keyboard Shortcut: Ctrl+v
'
Dim DW As Worksheet
Set DW = Worksheets("RM_FMP Washington (2)")
DW.Columns("A:A").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
DW.Columns("A:A").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
DW.Range("A1").FormulaR1C1 = "Voucher Number"
DW.Range("B1").FormulaR1C1 = "Document Type"
Dim DocumentType As Range
Dim VoucherNumber As Range
Dim LastROW As Long
Dim Analyst As String
Dim FM As String
Dim Allotment As String
Dim FY As String
Dim ROW As Integer
LastROW = DW.Cells(DW.Rows.Count, "C").End(xlUp).ROW
Set DocumentType = DW.Range(Cells(2, 2), Cells(LastROW, 2))
Set VoucherNumber = DW.Range(Cells(2, 1), Cells(LastROW, 1))
Analyst = Application.InputBox("Please provide first initial of the last name of the analyst processing of the Collections?") 'memory for a text string
FM = Application.InputBox("Please provide Letter representing the fiscal month of the collections?") 'memory for text string
Allotment = Application.InputBox("Provide the Cost Center Allotment Number") 'memory for text string
FY = Application.InputBox("Provide the Collection Fiscal Year") 'memory for text string
DocumentType.FormulaR1C1 = "=IF(Left(RC[2],2)=""19"",IF(LEFT(RC[3],2)=""10"",""IV"",IF(LEFT(RC[3],2)=""20"",""IV"",IF(LEFT(RC[3],2)=""30"",""IV"",IF(LEFT(RC[3],2)=""60"",""IV"",IF(LEFT(RC[3],1)=""8"",""IV"",IF(LEFT(RC[3],1)=""A"",""IV"",IF(LEFT(RC[3],2)=""17"",""IV"",""DW""))))))),""OA"")"
DocumentType.Copy
DocumentType.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Select= Allotment &FM &FY &Analyst &Text(Right(RC[2],4),""@"")
VoucherNumber.FormulaR1C1 = Concatenate(Application.InputBox(""Provide the Cost Center Allotment Number?""),Application.InputBox(""Please provide Letter representing the fiscal month of the collections?""),Application.InputBox(""Provide the Collection Fiscal Year""),Application.InputBox(""Please provide first initial of the last name of the analyst processing of the Collections?""),Text(Right(RC[2],4),""@""))"
'VoucherNumber.FormulaR1C1 = _
"=IF(RC[1]=""DW"",CONCATENATE(""8724"",IF(MONTH(NOW())=1,""A"",IF(MONTH(NOW())=2,""B"",IF(MONTH(NOW())=3, ""C"",IF(MONTH(NOW())=4,""D"",IF(MONTH(NOW())=5,""E"",IF(MONTH(NOW())=6,""F"",IF(MONTH(NOW())=7,""G"",IF(MONTH(NOW())=8,""H"",IF(MONTH(NOW())=9,""I"",IF(MONTH(NOW())=10,""J"",IF(MONTH(NOW())=11,""K"",IF(MONTH(NOW())=12,""L"","" "")))))))))))),RIGHT(LEFT(RC[1],2),1),""W"",RIGHT(RC[1],4)),IF(RC[1]=IV, CONCATENATE(""8724"",IF(MONTH(NOW())=1,""A"",IF(MONTH(NOW())=2,""B"",IF(MONTH(NOW())=3, ""C"",IF(MONTH(NOW())=4,""D"",IF(MONTH(NOW())=5,""E"",IF(MONTH(NOW())=6,""F"",IF(MONTH(NOW())=7,""G"",IF(MONTH(NOW())=8,""H"",IF(MONTH(NOW())=9,""I"",IF(MONTH(NOW())=10,""J"",IF(MONTH(NOW())=11,""K"",IF(MONTH(NOW())=12,""L"","" "")))))))))))),RIGHT(LEFT(RC[1],2),1),""W"",RIGHT(RC[1],4))"
'CopyPasteValueVN Macro
'VoucherNumber.Copy
'VoucherNumber.Select
'Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
Sub Voucher_Number()
'
' Voucher_Number Macro
' Insert column and concatenate
'
' Keyboard Shortcut: Ctrl+v
'
Dim DW As Worksheet
Set DW = Worksheets("RM_FMP Washington (2)")
DW.Columns("A:A").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
DW.Columns("A:A").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
DW.Range("A1").FormulaR1C1 = "Voucher Number"
DW.Range("B1").FormulaR1C1 = "Document Type"
Dim DocumentType As Range
Dim VoucherNumber As Range
Dim LastROW As Long
Dim Analyst As String
Dim FM As String
Dim Allotment As String
Dim FY As String
Dim ROW As Integer
LastROW = DW.Cells(DW.Rows.Count, "C").End(xlUp).ROW
Set DocumentType = DW.Range(Cells(2, 2), Cells(LastROW, 2))
Set VoucherNumber = DW.Range(Cells(2, 1), Cells(LastROW, 1))
Analyst = Application.InputBox("Please provide first initial of the last name of the analyst processing of the Collections?") 'memory for a text string
FM = Application.InputBox("Please provide Letter representing the fiscal month of the collections?") 'memory for text string
Allotment = Application.InputBox("Provide the Cost Center Allotment Number") 'memory for text string
FY = Application.InputBox("Provide the Collection Fiscal Year") 'memory for text string
DocumentType.FormulaR1C1 = "=IF(Left(RC[2],2)=""19"",IF(LEFT(RC[3],2)=""10"",""IV"",IF(LEFT(RC[3],2)=""20"",""IV"",IF(LEFT(RC[3],2)=""30"",""IV"",IF(LEFT(RC[3],2)=""60"",""IV"",IF(LEFT(RC[3],1)=""8"",""IV"",IF(LEFT(RC[3],1)=""A"",""IV"",IF(LEFT(RC[3],2)=""17"",""IV"",""DW""))))))),""OA"")"
DocumentType.Copy
DocumentType.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Select= Allotment &FM &FY &Analyst &Text(Right(RC[2],4),""@"")
VoucherNumber.FormulaR1C1 = Concatenate(Application.InputBox(""Provide the Cost Center Allotment Number?""),Application.InputBox(""Please provide Letter representing the fiscal month of the collections?""),Application.InputBox(""Provide the Collection Fiscal Year""),Application.InputBox(""Please provide first initial of the last name of the analyst processing of the Collections?""),Text(Right(RC[2],4),""@""))"
'VoucherNumber.FormulaR1C1 = _
"=IF(RC[1]=""DW"",CONCATENATE(""8724"",IF(MONTH(NOW())=1,""A"",IF(MONTH(NOW())=2,""B"",IF(MONTH(NOW())=3, ""C"",IF(MONTH(NOW())=4,""D"",IF(MONTH(NOW())=5,""E"",IF(MONTH(NOW())=6,""F"",IF(MONTH(NOW())=7,""G"",IF(MONTH(NOW())=8,""H"",IF(MONTH(NOW())=9,""I"",IF(MONTH(NOW())=10,""J"",IF(MONTH(NOW())=11,""K"",IF(MONTH(NOW())=12,""L"","" "")))))))))))),RIGHT(LEFT(RC[1],2),1),""W"",RIGHT(RC[1],4)),IF(RC[1]=IV, CONCATENATE(""8724"",IF(MONTH(NOW())=1,""A"",IF(MONTH(NOW())=2,""B"",IF(MONTH(NOW())=3, ""C"",IF(MONTH(NOW())=4,""D"",IF(MONTH(NOW())=5,""E"",IF(MONTH(NOW())=6,""F"",IF(MONTH(NOW())=7,""G"",IF(MONTH(NOW())=8,""H"",IF(MONTH(NOW())=9,""I"",IF(MONTH(NOW())=10,""J"",IF(MONTH(NOW())=11,""K"",IF(MONTH(NOW())=12,""L"","" "")))))))))))),RIGHT(LEFT(RC[1],2),1),""W"",RIGHT(RC[1],4))"
'CopyPasteValueVN Macro
'VoucherNumber.Copy
'VoucherNumber.Select
'Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub