For... Next VBA Problem

jlw200

New Member
Joined
Apr 1, 2009
Messages
5
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 moving different parts around with no luck. Thank you in advance.

Private Sub Rolled_Change()
Rolled = Rolled.Enabled

Dim i As Integer
Dim Section As String

Sheets("Database v13.0").Select

Range("A2").Select
Section = ActiveCell.Value
For i = 2 To 321
If Section = Not (Rolled.Value) Then
Next i
If Section = Rolled.Value Then Do

ActiveCell.Offset(0, 1).Select
A = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
d = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
bf = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
tw = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
tf = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
bf_2tf = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
h_tw = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
Ix = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
Zx = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
Sx = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
Iy = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
Ry = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
J = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
Cw = ActiveCell.Value

End If
 
easiest way is to set a breakpoint, debug menu, then run your macro, and as others said use f8 to step line by line and hold your mouse over variables to see the value they hold.
 
Upvote 0

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
Back
Top