Consulting

Results 1 to 5 of 5

Thread: Next With out for error

  1. #1
    VBAX Regular
    Joined
    Feb 2009
    Posts
    34
    Location

    Next With out for error

    I have anothre problem now I am getting a for without next error in my code does any one have an idea why. I am sure like the last problem it is a easy fix but I am just not seeing it
    here is the code


    [VBA]
    RngRow25.Select
    For Each RngRow25 In RFound25
    If RFound25.Value = YrVal Then

    With RFound25
    ActiveCell.Select

    .Offset(1, 1).Select
    CPRange26.Copy
    ActiveCell.PasteSpecial xlPasteFormulas
    Application.CutCopyMode = False
    End With
    Next RngRow25

    RngRow27.Select
    For Each RngRow27 In RFound27
    If RFound25.Value = YrVal Then

    With RFound27
    ActiveCell.Select

    .Offset(1, 1).Select
    CPRange28.Copy
    ActiveCell.PasteSpecial xlPasteFormulas
    Application.CutCopyMode = False
    End With
    Next RngRow27
    [/VBA]

  2. #2
    VBAX Regular
    Joined
    Feb 2009
    Posts
    34
    Location
    Nevermind I think it is because i do not have a end if in my code. That is why I solved it myself thanks anyway

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    1. Always use Option Explicit
    2. Indenting your code will show up such errors (see my signature)
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Regular
    Joined
    Feb 2009
    Posts
    34
    Location
    Thanks dude I will start to use the smart indent

  5. #5
    VBAX Tutor nst1107's Avatar
    Joined
    Nov 2008
    Location
    Monticello
    Posts
    245
    Location
    If your problem is solved, help keep the board clean by marking your thread solved. Near the top of the page, under "Thread Tools", you'll find the button to mark your thread as solved.

Posting Permissions

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