View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Mark Ivey[_2_] Mark Ivey[_2_] is offline
external usenet poster
 
Posts: 171
Default totally newbie question about macros and programing it

Glad to help out....

Mark Ivey

"Dexter" wrote in message
...

thank you!!its working perfect and i will make some modifications to
customize it for my needs
thank you
Mark Ivey wrote:
See if this will work for your needs...

Mark Ivey


Sub test()
Dim mySize As Integer
Dim myType As String
Dim myQuantity As Integer
Dim myNumber As Integer
Dim myResult As Long

mySize = InputBox("Input your desired size", "Input Size")
If mySize = 25 And mySize <= 35 Then
myType = "A"
ElseIf mySize = 36 And mySize <= 45 Then
myType = "B"
ElseIf mySize = 46 And mySize <= 55 Then
myType = "C"
Else: myType = ""
MsgBox "Please input a size between 25 to 55"
Exit Sub
End If


myQuantity = InputBox("Input a quantity", "Input Quantity")
If myQuantity < 1 Or myQuantity 50 Then
MsgBox "Please input a quantity between 1 to 50"
Exit Sub
End If


myNumber = InputBox("Input a number", "Input Number")
If myNumber < 5 Or myNumber 20 Then
MsgBox "Please input a number between 5 to 20"
Exit Sub
End If


myResult = (mySize * myQuantity) / myNumber

MsgBox "Type: " & myType & vbCrLf & vbCrLf & _
"Result: " & myResult, vbOKOnly

End Sub