Vba Excel Ie212

Only available on StudyMode
  • Download(s) : 110
  • Published : June 12, 2013
Open Document
Text Preview
IE 212: Computational Methods for Industrial Engineering
Final Project

Submitted by:

Winter 2013


In partial fulfillment of the requirements of this course, you are required to develop an application that calculates the power received by an antenna located at a distance d from a transmitting antenna. The necessary data to calculate the power received will be provided by the user by means of an input box. The power received calculated by your application must be reported in units of decibels (dB) and units of Watts (W).

The steps for the use of the program we created are really simple. First of all you need to place the parameters on an input box the program will display and then just press the calculate button.

When you open the excel document, first of all you need to click the button that says “PROCEED”, then you will have a sheet with two buttons and a reference box with tips and information for the program.

If you click on the button “Welcome Sheet” the program will just return to the main page, the one you see when you open the excel document. The other option is to continue the program and click on the button “Input Data” doing this a input box will show and ask for 5 parameters in an specific order.

After placing those values, they will be displayed on the sheet, and a new button will show up, “Calculate Power” if you click on it the program will do the calculations and show you the results of the calculation along with a chart.

Program Plan
Program Plan

Option Explicit

Public Worksheet As String
Public workS As Worksheet
Global PValues(4) As Double
Public PRdb As Double
Global c As Long
Global Watt As Double

Sub WelcomeNext()
'Proceedure to close welcome page and go to Input_output

Worksheet = "Input_Results"
Call InputN(Worksheet)

'clears cells

ActiveWindow.DisplayGridlines = False

End Sub

Sub InputN(Worksheet)

Worksheets(Worksheet).Visible = True
ActiveSheet.Visible = False

Worksheets("Input_Results").Shapes("Rounded Rectangle 5").Visible = False Worksheets("Input_Results").Shapes("Picture 6").Visible = False

End Sub

Sub InputNext()
'closes Input sheet & display welcome sheet

'Turn screen updating off
Application.ScreenUpdating = False

'clears cells

Worksheet = "Welcome"
Call InputN(Worksheet)

'Turn screen updating on
Application.ScreenUpdating = True


End Sub

Sub inputPropData()

Worksheets("Input_Results").Shapes("Picture 6").Visible = False
'clears range with data

Cells.ColumnWidth = 8

Cells.RowHeight = 20

'Turn screen updating off
Application.ScreenUpdating = False

Dim i As Integer
Dim ans As Double
Dim answerDB As String
Dim quit As String

'Store data
For i = 1 To 5
answerDB = InputBox("Enter the parameters in this order Pt, Gt, Gr, f, and d : ")
If answerDB = "" Then 'cancel button

quit = MsgBox("Do you really want to cancel data entry?", vbCritical + vbYesNo + vbDefaultButton1, "Please Confirm")
If quit = vbYes Then
Exit Sub

ElseIf quit = vbNo Then

End If

ElseIf IsNumeric(answerDB) Then
ans = CDbl(answerDB)

End If

If ans < 0 Or ans = 0 Then 'checks if user input i = i - 1 'one dim array

ElseIf i = 1 Then...
tracking img