next without for

  1. M

    Next Without For Error

    Hoping this just needs another set of eyes (ones better than mine). Getting Next without For error, verified that there is a For for every Next and vice versa via a word search, and embedded loops are contained entirely within the outer loop. The code is supposed to go though a list, find...
  2. R

    Next without For

    Private Sub EnterButton_Click() Dim MyPoNum As Long Dim MyDate As Date Dim MyQty As Long Dim MyPNum As String Dim MyRow As Long Dim cmb As combobox, i As Integer For i = 1 To 10 Set cmb = Me.Controls.Item("ComboBox" & i) MyPoNum = Me.txt_PoNum.Value MyDate = Me.txt_Date.Value...
  3. D

    Macro Compile Error "Next without for"

    Hello everyone. I am having a problem with my macro. It is giving me a compile error "Next without for" when I added this line "If Sheet1.Cells(i, 9) = Active Then". It worked perfectly before I added I am sure I am just missing a simple line of text. Your help is much appreciated. Sub...
  4. K

    VBA - DueDate and Next Without For errors

    Hey guys, great forum, I've been using it a lot while doing this work in Excel. I am writing code to have Tasks in Outlook created by a huge list of tasks in an Excel document. I want to skip all the blank rows and rows of assignments that are already completed. So I am trying to make it so if...
  5. I

    My VBA keeps giving a next without for error... What am I missing. Brain fried today..

    Sub Format() Dim i As Long For i = 5 To 99 ' Can edit 99 to the maximum row number needed If ActiveSheet.Cells(i, 3).Value <> "" Then 'Referencing difference between column N and C. We want N to be less than or equal to 7 days from C. If ActiveSheet.Cells(i, 14).Value = ""...
  6. D

    Next Without For When Many If Statements

    Hi, I am looping through the different sheets in a workbook and filtering by different criteria depending on the value of two different strings. There are 36 possible combinations of these string values so I need many If..ElseIf statements. However, when I have the full code I get an error...
  7. D

    Next without for error

    Hey guys I have been pulling my hair out trying to figure out why I am getting a next without for compile error. I'm running Excel 2010 and believe I have looped my Do While statement, looped my For Next statement, and also closed my if statement. My simplified code block is below. What am I...
  8. A

    Compile Error: Next without For?

    Here is the code, for some reason I am getting a next without for error. What is wrong with it? Sub MeanCEOAge() ' ' MeanCEOAge Macro ' Dim TotalAge As Integer Dim CEOcount As Integer Dim i As Integer TotalAge = 0 CEOcount = 0 For i = 2 To 51 If Cells(i, 5).Value = "CEO" Then...
  9. L

    HELP - Next without For on PrintFormat Macro

    I have little knowledge of VBA. Below is a recording I did w/modifications. I want the print format to apply to all tabs in the workbook. It had worked on individual tabs so I added more "language" to make it apply to all the tabs but I think I just made it worse - see below, and now I'm...
  10. J

    For... Next VBA Problem

    Good morning all, I am trying to help my wife out with a little VBA. She got assigned this project for grad school and neither one of us have ever had a VBA class. Looking at this statement, can you see what is wrong. I get a Next without For errer on running it. I have rearranged it and tried...

Some videos you may like

This Week's Hot Topics