FrankMcNally
Board Regular
- Joined
- Nov 14, 2014
- Messages
- 71
I'd thought I'd start a new thread as to separate my problems
I have the below:
Here's what '_AYZ81' looks like:
It works for (1,2,8 or 9) but NOT 7, likely due to the nested IFs which needs it to take each line on '_AYZ81' and based on value in Column 'D' return the value.
ANY and ALL help is appreciated
I have the below:
Code:
Sub Enter_Click() Dim NextRow As Long
Dim VA_Loop As Range
Dim VA_Loop_Value As Range
Sheets("_AYZ81").Activate
NextRow = Application.WorksheetFunction.CountA(Range("A:A")) + 1
Cells(NextRow, 1) = "VA" & VA_Number.Value & ".G" & G_Number
If VA_Number.Value = 1 Then Cells(NextRow + 3, 4) = "'251-9214-8396-957-000-E"
If VA_Number.Value = 2 Then Cells(NextRow + 3, 4) = "'251-9214-5235-958-000-E"
If VA_Number.Value = 8 Then Cells(NextRow + 3, 4) = "'251-9214-5235-956-000-E"
If VA_Number.Value = 9 Then Cells(NextRow + 3, 4) = "'251-9214-5235-956-000-E"
If VA_Number.Value = 7 Then
Set VA_Loop_Value = Sheet1.Range("H2:H9")
For Each VA_Loop In VA_Loop_Value
If VA_Loop = "0013" Then Worksheets("_AYZ81").Cells(NextRow + 3, 4) = "'251-9214-5232-999-000-E"
If VA_Loop = "0015" Then Worksheets("_AYZ81").Cells(NextRow + 3, 5) = "'251-9214-5232-999-000-E"
If VA_Loop = "0020" Then Worksheets("_AYZ81").Cells(NextRow + 3, 6) = "'251-9214-5232-999-000-E"
If VA_Loop = "0030" Then Worksheets("_AYZ81").Cells(NextRow + 3, 7) = "'251-9214-8704-999-000-E"
If VA_Loop = "0035" Then Worksheets("_AYZ81").Cells(NextRow + 3, 8) = "'251-9214-8704-999-000-E"
If VA_Loop = "0052" Then Worksheets("_AYZ81").Cells(NextRow + 3, 9) = "'251-9214-8396-999-000-E"
If VA_Loop = "0060" Then Worksheets("_AYZ81").Cells(NextRow + 3, 10) = "'251-9214-8415-999-000-E"
If VA_Loop = "0070" Then Worksheets("_AYZ81").Cells(NextRow + 3, 11) = "'251-9214-8415-999-000-E"
Next VA_Loop
End If
Unload Import_Information
End Sub
Here's what '_AYZ81' looks like:
What it is supposed to do is, pending on input of 'VA_Loop' (1,2,7,8 or 9 (obtained from a UserForm)) put in a particular string in Sheet '_AYZ81' Column H, three rows down from last cell used.
REQ# Req Total Req count ***** Product Curr Exchange rate SysDate Period PRN Acct# DueDate PayeeLine1 Amount 00000202100351507C001 ***** 00000003 0035 4000000000 01 ***** 2015/10/06 151607 ***** 0 2015/09/09 ***** $738.62 00000202100351507C001 ***** 00000003 0035 4000000000 01 ***** 2015/10/06 151607 ***** 0 2015/09/09 ***** $1,399.82 00000202100351507C001 ***** 00000003 0035 4000000000 01 ***** 2015/10/06 151607 ***** 0 2015/09/09 ***** $937.74 00000602100521507C002 ***** 00000001 0052 4000000000 01 ***** 2015/10/06 151607 ***** 0 2015/08/27 ***** $65.00
<tbody>
</tbody>
It works for (1,2,8 or 9) but NOT 7, likely due to the nested IFs which needs it to take each line on '_AYZ81' and based on value in Column 'D' return the value.
ANY and ALL help is appreciated