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

Excel , Macro , VBA Johannesburg, South Africa
  • 8 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”)
    
    
    
    Do
    
                If Interest < 0 Then
    
                            worksheets(“Pram”).Range(“B12”) = worksheets(“Calc”).Range(“A2”)
    
                Else
    
                            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

    thanks

Post a reply

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

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

Contribute

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.

“You can stand on the shoulders of giants OR a big enough pile of dwarfs, works either way.”