Macro in Excel, and If statement that needs to loop through a range

Excel , Macro , VBA Johannesburg, South Africa
  • 9 years ago

    Hi guys

    I know that it is such a simple step I am missing in this code.

    It is a macro for excel

    Sub Marco()
    Dim Interest 
                Interest = worksheets(“Calc”).Range(“J2”)
                If Interest < 0 Then
                            worksheets(“Pram”).Range(“B12”) = worksheets(“Calc”).Range(“A2”)
                            worksheets(“Pram”).Range(“B12”) =[ “No Problem”]
                End If
                Loop until Interest < 0
    End Sub

    I need the loop to keep running until the interest is Less than 0 The cell Ref worksheets(“Calc”).Range(“J2”) needs to increase to worksheets(“Calc”).Range(“J3”) And worksheets(“Calc”).Range(“A2”) needs to increase to worksheets(“Calc”).Range(“A3”)

    And so until the result is less than Zero


Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC. As potential programmers, they are mentally mutilated beyond hope of regeneration.” - E. W. Dijkstra