Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88809

Excel VBA While loop

$
0
0

I need help fixing the loop below:

Dim Lastrow As Long
Dim i As Variant
Dim Valid As Boolean
Dim inputDec As Integer

Lastrow = Range("D65000").End(xlUp).Row

While Valid = False
    i = InputBox("Ve kterém sloupci je datum? (A=1,B=2,C=3, atd..)", "Datum")

        If IsNumeric(i) Then
                Valid = True
            Else
                Valid = False
                MsgBox ("Zadejte číslo sloupce! (A=1,B=2,C=3, atd..)")
        End If

Wend

You can't enter letters etc.. But the problem is, that you can enter < 0. I was trying CODE like

If IsNumeric(i) And ">0" Then

But that doesnt work and ended in ERROR, can anyone help me please?


Viewing all articles
Browse latest Browse all 88809

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>