Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default totally newbie question about macros and programing it

every day i have to calculate something on job so i got idea to make one
macro that will help me. in school i worked on Q-basic :) and i know
this shoudn't be problem with macro but dunno where to start so please
help me.
i have 4 variables:
first is size and goes from 25 < =35 or 35 < = 45 or 45 < = 55 ....
second is type has just three values A or B or C
third is quantity and it goes from 1-50
and forth is number from 5-20
i would like to make it to ask me to insert first value then second,
then third and fourth ...
so if first value is for example 37 second value is B to pick up price
for that value that is for example 59 multiple it with quantity value
and divide it by fourth value...
i hope i was clear with what i want
so any help
please
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default totally newbie question about macros and programing it

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default totally newbie question about macros and programing it


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

  #4   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel question borderline programing gimp New Users to Excel 1 June 25th 06 06:01 AM
totally newbie to VBA need help cuongvt Excel Programming 1 September 29th 05 06:24 AM
Microsoft excel macros Programing. Roberto Torres Perez Excel Programming 1 May 13th 05 09:18 AM
Sharing macros - extreme newbie question I know. rfalke[_2_] Excel Programming 1 October 13th 04 07:56 PM
Sharing macros - extreme newbie question I know. rfalke Excel Programming 1 October 13th 04 06:08 PM


All times are GMT +1. The time now is 06:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"