PDA

View Full Version : Next With out for error



viomman
03-04-2009, 09:23 AM
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



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

viomman
03-04-2009, 09:26 AM
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

mdmackillop
03-04-2009, 09:32 AM
1. Always use Option Explicit
2. Indenting your code will show up such errors (see my signature)

viomman
03-04-2009, 10:37 AM
Thanks dude I will start to use the smart indent

nst1107
03-04-2009, 01:07 PM
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.