Checking data with a loop

S

Syrus the Virus

Hi,

I'm not the best programmer in the world and I'm in need of help. I wa
trying to make a loop

Sub macro2()
Dim Nummer As String

Worksheets("Sheet1").Activate
Do Until Nummer > 0
Nummer = Application.InputBox("Doe eens een nummer"
"Selecteren", Type:=2)
Exit Do
Loop
Range("B12").Select
With Selection.Font
.Name = "Arial"
.Size = Nummer
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

End Sub


But it did not work. I tried to check the input but it failed. And ho
do I set borders (input between 10 and 30 (for example)

Tnxs in advanced
 
B

Bob Phillips

Try this alternate

Sub macro2()
Dim Nummer As Integer

Worksheets("Sheet1").Activate

Do Until Nummer > 0
Nummer = Application.InputBox("Doe eens een nummer", "Selecteren",
Type:=2)
Loop

With Range("B12").Font
.Name = "Arial"
.Size = Nummer
End With

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top