Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports

Results 1 to 3 of 3

Thread: VBA: Next without for?

  1. #1
    Join Date
    11th May 2006

    VBA: Next without for?

    Hi again,

    Can anybody figure out what I am doing wrong? Excel says "Next without for":

    For i = 3 To no_cont + 2 
        pol = Worksheets("INPUT").Cells(i, 1).Value 
        pod = Worksheets("INPUT").Cells(i, 2).Value 
        pofd = Worksheets("INPUT").Cells(i, 3).Value 
        cont_id = Worksheets("INPUT").Cells(i, 4).Value 
        qty = Worksheets("INPUT").Cells(i, 5).Value 
        cont_type = Worksheets("INPUT").Cells(i, 8).Value 
        cont_weight = Worksheets("INPUT").Cells(i, 9).Value 
        cont_line = Worksheets("INPUT").Cells(i, 11).Value 
        stow = Worksheets("INPUT").Cells(i, 20).Value 
        Select Case Worksheets("INPUT").Cells(i, 11).Value 
        Case "E" 
            mty_val.Value = "Y" 
        Case Else 
            mty_val.Value = "N" 
        End Select 
        Select Case Worksheets("INPUT").Cells(i, 20).Value 
        Case Is <> "" 
            stow = Worksheets("INPUT").Cells(i, 20).Value 
        Case Else 
            stow = "      " 
            Print #FileNum, Space(3); qty & cont_id & " " & cont_type & Format$(cont_weight, "0.00") & pol & pod & pofd & cont_line; Spc(2); stow; Spc(2); prv_stow _ 
        Next i 

    Excel Video Tutorials / Excel Dashboards Reports

  2. #2
    Join Date
    22nd April 2003
    Virginia, USA

    Re: VBA: Next without for?

    Looks like it's because you don't have an End Select for your second Select Case.
    Last edited by thomach; May 12th, 2006 at 00:08.
    Best Regards,
    Please help Oz share knowledge among all users by posting your questions in a public forum rather than using a Private Message.

  3. #3
    Join Date
    11th May 2006

    [SOLVED] VBA: Next without for?

    Thank you very much thomach. Solved immediately

    Excel Video Tutorials / Excel Dashboards Reports

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts