Launching of G-Matrix Calculator Program (Using "Start Here" Button)
Launching of G-Matrix Calculator Program (Using "Start Here" Button)
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
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
BadEntry:
MsgBox Error, vbOKOnly, An Error Occured
End Sub
LAUNCHING QUADRATIC EQUATION SOLVER (AFTER SELECTING GO TO
QUADRATIC EQUATION SOLVER)
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
vbOKOnly, "Error"
vbOKOnly, "Error"
vbOKOnly, "Error"
vbOKOnly, "Error"
vbOKOnly, "Error"
vbOKOnly, "Error"
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
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"
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
-----------------------------------------------------------------------------------------------------------------------------------------
Cells(4,
Cells(4,
Cells(4,
Cells(4,
Cells(4,
Cells(5,
Cells(5,
Cells(5,
Cells(5,
Cells(5,
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