Need help with this code, it counts only the second after "And".And if it possible to do like if cell("2.3")<point
Is it possible to do aritmetics with cells or do smth with other operators?

Sub hugo()
    Dim point As Double

    InputBox ("Enter The Closing Point(Between 1.1-1.6)")

    If point >= 1.1 And point < 1.6 Then
        MsgBox ("Reenter point")
        InputBox ("Enter The Closing Point")
        Range("D25").Value = InputBox("Enter The Closing Point(Between 1.1-1.6)")
    End If
End Sub

Edited 4 Years Ago by deceptikon: Changed to discussion thread

In excel math between cells is handled by functions. Any regular math can easily be done, adding, subtracting, multiplying, dividing, between individual cells and/or range of cells. More complicated math can also be accomplished but the learning curve goes up lol.

Public Sub EnterTheSum()
Dim strsum As String

strsum = Application.InputBox("Enter the sum")
If (strsum > 5000) Then
MsgBox ("Reenter sum")
strsum = Application.InputBox("Enter the sum")
Range("C5").Value = strsum
Range("C5").Value = strsum

End If
End Sub

Tricky little excel.what to do if vba ignores else statement?I know this code is wrong ,but it works -until second wrong input, and "else ".Yesterday was ok, now i have to do my project from the begining...

Try this. Some of the syntax might not be 100% but you should be able to figure it out. 'strsum starts out with a value of 5000 but the while loop will trap it until it changes.

Dim strsum as string = 5000
while strsum >= 5000
    strsum = Application.InputBox("Enter the sum(under 5000)")
Range("C5").Value = strsum

Edited 4 Years Ago by tinstaafl

This article has been dead for over six months. Start a new discussion instead.