0% found this document useful (0 votes)
52 views

Launching of G-Matrix Calculator Program (Using "Start Here" Button)

The document contains code for launching and using a G-matrix calculator program. It includes subroutines for launching the calculator environment and different calculators within it, including a matrix calculator for determinants and inverses, and a quadratic equation solver. Validation checks are included to ensure the proper input and calculation of solutions.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Launching of G-Matrix Calculator Program (Using "Start Here" Button)

The document contains code for launching and using a G-matrix calculator program. It includes subroutines for launching the calculator environment and different calculators within it, including a matrix calculator for determinants and inverses, and a quadratic equation solver. Validation checks are included to ensure the proper input and calculation of solutions.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

LAUNCHING OF G-MATRIX CALCULATOR PROGRAM (Using Start Here

Button)
Private Sub starts_Click()
UserForm4.Show
End Sub
LAUNCHING ENVIRONMENT WITH OPTIONS FOR G-MATRIX CALCULATOR
(Using Userform)
Private Sub CommandButton1_Click()
GRAPH.Show
Sheet1.Select
Unload Me
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton2_Click()
UserForm1.Show
Unload Me
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton3_Click()
UserForm2.Show
Unload Me
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton4_Click()
Sheet4.Select
Unload Me
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton5_Click()
Sheet5.Select
Unload Me
End Sub
LAUNCHING MATRIX CALCULATOR (AFTER SELECTING GO TO MATRIX
SOLVER)
Private Sub OptionButton1_Click()
Sheet2.Select
Unload Me
End Sub

----------------------------------------------------------------------------------------------------------------------------------------Private Sub OptionButton2_Click()


Sheet3.Select
Unload Me
End Sub
SOLVING MATRIX FOR DETERMINANTS (AFTER SELECTING FINDING THE
DETERMINANT OF MATRICES)
Option Explicit
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton1_Click()
On Error GoToBadEntry
Range("A2:B3").Range("A16").Formula = "=MDETERM(A2:B3)"
BadEntry:
MsgBox Error, vbOKOnly, An Error Occured
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton2_Click()
On Error GoToBadEntry
Range("A2:C4").Range("B16").Formula = "=MDETERM(A2:C4)"
BadEntry:
MsgBox Error, vbOKOnly, An Error Occured
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton3_Click()
On Error GoToBadEntry
Range("A2:D5").Range("C16").Formula = "=MDETERM(A2:D5)"
BadEntry:
MsgBox Error, vbOKOnly, An Error Occured
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton4_Click()
Sheet1.Select
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub OptionButton1_Click()
Range("A2:B3").Interior.Color = vbBlue

Range("A4:D5").Interior.Color = vbWhite
Range("C2:D3").Interior.Color = vbWhite
Range("A2:B3").Font.Color = vbWhite
Sheet2.Cells.ClearContents
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub OptionButton2_Click()
Range("A2:C4").Interior.Color = vbGreen
Range("A5:D5").Interior.Color = vbWhite
Range("D2:D5").Interior.Color = vbWhite
Range("A2:C4").Font.Color = vbBlack
Sheet2.Cells.ClearContents
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub OptionButton3_Click()
Range("A2:D5").Interior.Color = vbYellow
Range("A2:D5").Font.Color = vbBlack
Sheet2.Cells.ClearContents
End Sub
SOLVING MATRIX FOR INVERSE (AFTER SELECTING INVERSE)
Private Sub CommandButton1_Click()
Sheet1.Select
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub Inverse_Click()
Dim A As Variant, c#(), x#, y#
Dim m&, u#, i&, j&, rv&()
Dim q&, w&
On Error GoToBadEntry
Set A = Cells(1).CurrentRegion
m = A.Rows.Count'UBound(a, 1)
ReDimc(1 To m, 1 To m), rv(1 To m, 1 To 2)
For i = 1 To m: c(i, i) = 1: Next i
For q = 1 To m
u = 10 ^ 15
For i = 1 To m
If rv(i, 1) = 0 Then
If A(i, q) <> 0 Then
If (Log(A(i, q) ^ 2)) ^ 2 < u Then

u = (Log(A(i, q) ^ 2)) ^ 2
w=i
End If
End If
End If
Next i

rv(w, 1) = w: rv(q, 2) = w: x = A(w, q)


For j = 1 To m
A(w, j) = A(w, j) / x
c(w, j) = c(w, j) / x
Next j
For i = 1 To m
If rv(i, 1) = 0 Then
y = A(i, q)
For j = 1 To m
A(i, j) = A(i, j) - y * A(w, j)
c(i, j) = c(i, j) - y * c(w, j)
Next j
End If
Next i, q
'BACK SOLUTION
For q = m To 2 Step -1: For w = q - 1 To 1 Step -1
x = A(rv(w, 2), q)
A(rv(w, 2), q) = A(rv(w, 2), q) - x * A(rv(q, 2), q)
For j = 1 To m
c(rv(w, 2), j) = c(rv(w, 2), j) - x * c(rv(q, 2), j)
Next j
Next w, q
For q = 1 To m: For j = 1 To m
A(q, j) = c(rv(q, 2), j)
Next j, q
Cells(m + 2, 1).Resize(m, m) = A

BadEntry:
MsgBox Error, vbOKOnly, An Error Occured
End Sub
LAUNCHING QUADRATIC EQUATION SOLVER (AFTER SELECTING GO TO
QUADRATIC EQUATION SOLVER)

Private Sub CommandButton1_Click()


Dim A As String

Dim B As String
Dim c As String
Dim x1 As Double
Dim x2 As Double
On Error GoToBadEntry
'Equation 1
A = TextBox1
B = TextBox2
c = TextBox3
BadEntry:
MsgBox Error, vbOKOnly, An Error Occured

If A = "" And B = "" And c = "" Then


MsgBox "Please Type a Quadratic Equation", vbOKOnly, "Error"
On Error Resume Next
ElseIf A = "0" Then
MsgBox "Please Type a Quadratic Equation", vbOKOnly, "Error"
On Error Resume Next
ElseIf A = "" Then
MsgBox "Please Enter a Numeric Value in the Box 1, Equation 1",
On Error Resume Next
ElseIf B = "" Then
MsgBox "Please Enter a Numeric Value in the Box 2, Equation 1",
On Error Resume Next
ElseIf c = "" Then
MsgBox "Please Enter a Numeric Value in the Box 3, Equation 1",
On Error Resume Next
ElseIfIsNumeric(A) = False Then
MsgBox "Please Enter a Numeric Value in the Box 1, Equation 1",
On Error Resume Next
ElseIfIsNumeric(B) = False Then
MsgBox "Please Enter a Numeric Value in the Box 2, Equation 1",
On Error Resume Next
ElseIfIsNumeric(c) = False Then
MsgBox "Please Enter a Numeric Value in the Box 3, Equation 1",
On Error Resume Next
End If
If (B ^ 2 - 4 * A * c) < 0 Then
MsgBox "Not a Real Root", vbOKOnly, "Error"
On Error Resume Next
End If

vbOKOnly, "Error"

vbOKOnly, "Error"

vbOKOnly, "Error"

vbOKOnly, "Error"

vbOKOnly, "Error"

vbOKOnly, "Error"

x1 = (-B - (Sqr(B ^ 2 - 4 * A * c))) / (2 * A)


x2 = (-B + (Sqr(B ^ 2 - 4 * A * c))) / (2 * A)

TextBox13 = x1
TextBox14 = x2

End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton2_Click()
'Equation 2
Dim d, e, f As String
Dim x3, x4 As Double
On Error GoToBadEntry
d = TextBox4
e = TextBox5
f = TextBox6
If d = "" And e = "" And f = "" Then
MsgBox "Please Type a Quadratic Equation", vbOKOnly, "Error"
On Error Resume Next
ElseIf d = "0" Then
MsgBox "Please Type a Quadratic Equation", vbOKOnly, "Error"
On Error Resume Next
ElseIf d = "" Then
MsgBox "Please Enter a Numeric Value in the Box A, Equation 2", vbOKOnly,
On Error Resume Next
ElseIf e = "" Then
MsgBox "Please Enter a Numeric Value in the Box B, Equation 2", vbOKOnly,
On Error Resume Next
ElseIf f = "" Then
MsgBox "Please Enter a Numeric Value in the Box C, Equation 2", vbOKOnly,
On Error Resume Next
ElseIfIsNumeric(d) = False Then
MsgBox "Please Enter a Numeric Value in the Box A, Equation 2", vbOKOnly,
On Error Resume Next
ElseIfIsNumeric(e) = False Then
MsgBox "Please Enter a Numeric Value in the Box B, Equation 2", vbOKOnly,
On Error Resume Next
ElseIfIsNumeric(f) = False Then

"Error"

"Error"

"Error"

"Error"

"Error"

MsgBox "Please Enter a Numeric Value in the Box C, Equation 2", vbOKOnly, "Error"
On Error Resume Next
End If
If (e ^ 2 - 4 * d * f) < 0 Then
MsgBox "Not a Real Root", vbOKOnly, "Error"
On Error Resume Next
End If
x3 = (-e - (Sqr(e ^ 2 - 4 * d * f))) / (2 * d)
x4 = (-e + (Sqr(e ^ 2 - 4 * d * f))) / (2 * d)
TextBox15 = x3
TextBox16 = x4

BadEntry:
MsgBox Error, vbOKOnly, An Error Occured
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton3_Click()
'Equation 3
Dim g, h, iAs String
Dim x5, x6 As Double
On Error GoToBadEntry
g = TextBox7
h = TextBox8
i = TextBox9
If g = "" And h = "" And i = "" Then
MsgBox "Please Type a Quadratic Equation", vbOKOnly, "Error"
On Error Resume Next
ElseIf g = "0" Then
MsgBox "Please Type a Quadratic Equation", vbOKOnly, "Error"
On Error Resume Next
ElseIf g = "" Then
MsgBox "Please Enter a Numeric Value in the Box A, Equation 3", vbOKOnly, "Error"
On Error Resume Next
ElseIf h = "" Then
MsgBox "Please Enter a Numeric Value in the Box B, Equation 3", vbOKOnly, "Error"
On Error Resume Next

ElseIfi = "" Then


MsgBox "Please Enter a Numeric
On Error Resume Next
ElseIfIsNumeric(g) = False Then
MsgBox "Please Enter a Numeric
On Error Resume Next
ElseIfIsNumeric(h) = False Then
MsgBox "Please Enter a Numeric
On Error Resume Next
ElseIfIsNumeric(i) = False Then
MsgBox "Please Enter a Numeric
On Error Resume Next
End If

Value in the Box C, Equation 3", vbOKOnly, "Error"

Value in the Box A, Equation 3", vbOKOnly, "Error"

Value in the Box B, Equation 3", vbOKOnly, "Error"

Value in the Box C, Equation 3", vbOKOnly, "Error"

If (h ^ 2 - 4 * g * i) < 0 Then
MsgBox "Not a Real Root", vbOKOnly, "Error"
On Error Resume Next
End If
x5 = (-h - (Sqr(h ^ 2 - 4 * g * i))) / (2 * g)
x6 = (-h + (Sqr(h ^ 2 - 4 * g * i))) / (2 * g)
TextBox17 = x5
TextBox18 = x6

BadEntry:
MsgBox Error, vbOKOnly, An Error Occured
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton4_Click()
'Equation 4
Dim j, k, l As String
Dim x7, x8 As Double
On Error GoToBadEntry
j = TextBox10
k = TextBox11
l = TextBox12
If j = "" And k = "" And l = "" Then
MsgBox "Please Type a Quadratic Equation", vbOKOnly, "Error"

On Error Resume Next


ElseIf j = "" Then
MsgBox "Please Enter a Numeric
On Error Resume Next
ElseIf k = "" Then
MsgBox "Please Enter a Numeric
On Error Resume Next
ElseIf l = "" Then
MsgBox "Please Enter a Numeric
On Error Resume Next
ElseIfIsNumeric(j) = False Then
MsgBox "Please Enter a Numeric
On Error Resume Next
ElseIfIsNumeric(k) = False Then
MsgBox "Please Enter a Numeric
On Error Resume Next
ElseIfIsNumeric(l) = False Then
MsgBox "Please Enter a Numeric
On Error Resume Next
End If

Value in the Box A, Equation 4", vbOKOnly, "Error"

Value in the Box B, Equation 4", vbOKOnly, "Error"

Value in the Box C, Equation 4", vbOKOnly, "Error"

Value in the Box A, Equation 4", vbOKOnly, "Error"

Value in the Box B, Equation 4", vbOKOnly, "Error"

Value in the Box C, Equation 4", vbOKOnly, "Error"

If (k ^ 2 - 4 * j * l) < 0 Then
MsgBox "Not a Real Root", vbOKOnly, "Error"
On Error Resume Next
End If
x7 = (-k - (Sqr(k ^ 2 - 4 * j * l))) / (2 * j)
x8 = (-k + (Sqr(k ^ 2 - 4 * j * l))) / (2 * j)
TextBox19 = x7
TextBox20 = x8

BadEntry:
MsgBox Error, vbOKOnly, An Error Occured
End Sub
-----------------------------------------------------------------------------------------------------------------------------------------

Private Sub CommandButton5_Click()


UserForm4.Show
UserForm1.Hide
Unload Me
End Sub

LAUNCHING POLYNOMIAL EQUATION GRAPH MAKER (AFTER SELECTING


GO TO POLYNOMIAL FUNCTION GRAPH MAKER)
Private Sub a1_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox

'Allow for negative numbers


If Not IsNumeric(a1.Value) And a1 <> "-" And a1 <> "" Then
a1 = Left(a1, Len(a1) - 1)
End If
'Change to default value if blank
If a1 = "" Then a1 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub a2_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(a2.Value) And a2 <> "-" And a2 <> "" Then
a2 = Left(a2, Len(a2) - 1)
End If
'Change to default value if blank
If a2 = "" Then a2 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub a3_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(a3.Value) And a3 <> "-" And a3 <> "" Then
a3 = Left(a3, Len(a3) - 1)
End If
'Change to default value if blank
If a3 = "" Then a3 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub a4_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers

If Not IsNumeric(a4.Value) And a4 <> "-" And a4 <> "" Then


a4 = Left(a4, Len(a4) - 1)
End If
'Change to default value if blank
If a4 = "" Then a4 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub b1_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(b1.Value) And b1 <> "-" And b1 <> "" Then
b1 = Left(b1, Len(b1) - 1)
End If
'Change to default value if blank
If b1 = "" Then b1 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub b2_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(b2.Value) And b2 <> "-" And b2 <> "" Then
b2 = Left(b2, Len(b2) - 1)
End If
'Change to default value if blank
If b2 = "" Then b2 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub b3_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(b3.Value) And b3 <> "-" And b3 <> "" Then
b3 = Left(b3, Len(b3) - 1)
End If
'Change to default value if blank
If b3 = "" Then b3 = 0
End Sub
-----------------------------------------------------------------------------------------------------------------------------------------

Private Sub b4_Change()


'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(b4.Value) And b4 <> "-" And b4 <> "" Then
b4 = Left(b4, Len(b4) - 1)
End If
'Change to default value if blank
If b4 = "" Then b4 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub c1_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(c1.Value) And c1 <> "-" And c1 <> "" Then
c1 = Left(c1, Len(c1) - 1)
End If
'Change to default value if blank
If c1 = "" Then c1 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub c2_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(c2.Value) And c2 <> "-" And c2 <> "" Then
c2 = Left(c2, Len(c2) - 1)
End If
'Change to default value if blank
If c2 = "" Then c2 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub c3_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(c3.Value) And c3 <> "-" And c3 <> "" Then
c3 = Left(c3, Len(c3) - 1)
End If

'Change to default value if blank


If c3 = "" Then c3 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub c4_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(c4.Value) And c4 <> "-" And c4 <> "" Then
c4 = Left(c4, Len(c4) - 1)
End If
'Change to default value if blank
If c4 = "" Then c4 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton1_Click()
Cells(2, 9) = a1 + "x^3" + "+" + b1 + "x^2" + "+" + c1 + "x" + "+" + d1
Cells(2, 12) = a1
Cells(2, 13) = b1
Cells(2, 14) = c1
Cells(2, 15) = d1
Cells(3,
Cells(3,
Cells(3,
Cells(3,
Cells(3,

9) = a2 + "x^3" + "+" + b2 + "x^2" + "+" + c2 + "x" + "+" + d2


12) = a2
13) = b2
14) = c2
15) = d2

Cells(4,
Cells(4,
Cells(4,
Cells(4,
Cells(4,

9) = a3 + "x^3" + "+" + b3 + "x^2" + "+" + c3 + "x" + "+" + d3


12) = a3
13) = b3
14) = c3
15) = d3

Cells(5,
Cells(5,
Cells(5,
Cells(5,
Cells(5,

9) = a4 + "x^3" + "+" + b4 + "x^2" + "+" + c4 + "x" + "+" + d4


12) = a4
13) = b4
14) = c4
15) = d4

MsgBox "Done Graphing!"


response = MsgBox("Do you want to enter another funtion?", _
vbYesNo)

If response = vbYes Then


a1 = ""
a2 = ""
a3 = ""
a4 = ""
b1 = ""
b2 = ""
b3 = ""
b4 = ""
c1 = ""
c2 = ""
c3 = ""
c4 = ""
d1 = ""
d2 = ""
d3 = ""
d4 = ""
a1.SetFocus
a2.SetFocus
a3.SetFocus
a4.SetFocus
b1.SetFocus
b2.SetFocus
b3.SetFocus
b4.SetFocus
c1.SetFocus
c2.SetFocus
c3.SetFocus
c4.SetFocus
d1.SetFocus
d2.SetFocus
d3.SetFocus
d4.SetFocus
Else
Unload Me
End If
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub d1_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(d1.Value) And d1 <> "-" And d1 <> "" Then
d1 = Left(d1, Len(d1) - 1)
End If

'Change to default value if blank


If d1 = "" Then d1 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub d2_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(d2.Value) And d2 <> "-" And d2 <> "" Then
d2 = Left(d2, Len(d2) - 1)
End If
'Change to default value if blank
If d2 = "" Then d2 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub d3_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(d3.Value) And d3 <> "-" And d3 <> "" Then
d3 = Left(d3, Len(d3) - 1)
End If
'Change to default value if blank
If d3 = "" Then d3 = 0
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub d4_Change()
'PURPOSE: Prevent user from entering non-numerical values in userform textbox
'Allow for negative numbers
If Not IsNumeric(d4.Value) And d4 <> "-" And d4 <> "" Then
d4 = Left(d4, Len(d4) - 1)
End If
'Change to default value if blank
If d4 = "" Then d4 = 0
End Sub
-----------------------------------------------------------------------------------------------------------------------------------------

LAUNCHING EXPONENTIAL GRAPH MAKER (AFTER SELECTING GO TO


EXPONENTIAL GRAPH MAKER)
FOR CLEAR:
Private Sub CommandButton2_Click()
A = "1"
B = "0"

Sheet4.Range("B2", "B12").ClearContents
End Sub
----------------------------------------------------------------------------------------------------------------------------------------FOR GRAPH:
Private Sub CommandButton1_Click()
Dim x As Integer
Dim aa As Integer
On Error GoToBadEntry
x = A.Value
aa = B.Value
Cells(2, 2) = x ^ -5 + aa
Cells(3, 2) = x ^ -4 + aa
Cells(4, 2) = x ^ -3 + aa
Cells(5, 2) = x ^ -2 + aa
Cells(6, 2) = x ^ -1 + aa
Cells(7, 2) = x ^ 0 + aa
Cells(8, 2) = x ^ 1 + aa
Cells(9, 2) = x ^ 2 + aa
Cells(10, 2) = x ^ 3 + aa
Cells(11, 2) = x ^ 4 + aa
Cells(12, 2) = x ^ 5 + aa

MsgBox "Your graph is finished!",vbOKOnly, "DONE GRAPHING"


BadEntry:
MsgBox Err & ":" &Error(Err)
End Sub
-----------------------------------------------------------------------------------------------------------------------------------------

LAUNCHING EXPONENTIAL GRAPH MAKER (AFTER SELECTING GO TO


EXPONENTIAL GRAPH MAKER)
FOR CLEAR:
Private Sub CommandButton2_Click()
A = "1"
Sheet5.Range("B2", "B21").ClearContents
End Sub
----------------------------------------------------------------------------------------------------------------------------------------Private Sub CommandButton1_Click()
Dim x As Integer
Dim msgAs String
On Error GoToBadEntry
x = A.Value
Cells(2, 2) = Log(1) / Log(x)
Cells(3, 2) = Log(2) / Log(x)
Cells(4, 2) = Log(3) / Log(x)
Cells(5, 2) = Log(4) / Log(x)
Cells(6, 2) = Log(5) / Log(x)
Cells(7, 2) = Log(6) / Log(x)
Cells(8, 2) = Log(7) / Log(x)
Cells(9, 2) = Log(8) / Log(x)
Cells(10, 2) = Log(9) / Log(x)
Cells(11, 2) = Log(10) / Log(x)
Cells(12, 2) = Log(11) / Log(x)
Cells(13, 2) = Log(12) / Log(x)
Cells(14, 2) = Log(13) / Log(x)
Cells(15, 2) = Log(14) / Log(x)
Cells(16, 2) = Log(15) / Log(x)
Cells(17, 2) = Log(16) / Log(x)
Cells(18, 2) = Log(17) / Log(x)
Cells(19, 2) = Log(18) / Log(x)
Cells(20, 2) = Log(19) / Log(x)
Cells(21, 2) = Log(20) / Log(x)
Unload Me
MsgBox "Your Graph is finished!",vbOKOnly, "DONE GRAPHING"
BadEntry:

MsgBox Err & ":" &Error(Err)


End Sub
-----------------------------------------------------------------------------------------------------------------------------------------

You might also like