next without for

  1. T

    Next without For, End If without Block If

    Hi All, I've moved around my "if" and "end if", as well as the "for" and "next" statements in my code, but I continue to get one of those two errors no matter where I move the statements. Here is my code: Option Explicit Private Sub worksheet_change(ByVal Target As Range) Dim...
  2. 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...
  3. 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...
  4. 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...
  5. 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...
  6. 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 = ""...
  7. 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...
  8. 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...
  9. 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...
  10. 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...
  11. 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...

Watch MrExcel Video

This Week's Hot Topics

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
Top