Not returning Text to Cell

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:
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:
REQ#Req TotalReq count*****ProductCurrExchange rateSysDatePeriodPRNAcct#DueDatePayeeLine1Amount
00000202100351507C001*****000000030035400000000001*****2015/10/06151607*****02015/09/09*****$738.62
00000202100351507C001*****000000030035400000000001*****2015/10/06151607*****02015/09/09*****$1,399.82
00000202100351507C001*****000000030035400000000001*****2015/10/06151607*****02015/09/09*****$937.74
00000602100521507C002*****000000010052400000000001*****2015/10/06151607*****02015/08/27*****$65.00

<tbody>
</tbody>
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.

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
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,215,389
Messages
6,124,662
Members
449,178
Latest member
Emilou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top