Here is my ridiculous looking code. The is the first macro I've ever made, so keep that in mind when you see my stupid programming style.
'********SIGNIFICANCE TESTING*********** (NOT COMPLETE/WORKING)
'This prompts the user to indicate whether they want to
'do significance testing
Dim sigTest As String, anotherSigtest As String
sigTest = InputBox("Do you want significance testing? 'y' = yes")
If sigTest = "y" Then
Do
Dim Col1ToTest As String, Col2ToTest As String
Col1ToTest = InputBox("Choose the first column to test (ie. If the first if you want to test is column B against C, Type 'B'")
Do Until Col1ToTest = "A" Or Col1ToTest = "B" Or Col1ToTest = "C" Or _
Col1ToTest = "D" Or Col1ToTest = "E" Or Col1ToTest = "F" Or Col1ToTest = "G" Or _
Col1ToTest = "H" Or Col1ToTest = "I" Or Col1ToTest = "J" Or Col1ToTest = "K" Or _
Col1ToTest = "L" Or Col1ToTest = "M" Or Col1ToTest = "N" Or Col1ToTest = "O" Or _
Col1ToTest = "P" Or Col1ToTest = "Q" Or Col1ToTest = "R" Or Col1ToTest = "S"
MsgBox ("Your response is not valid, try again")
Col1ToTest = InputBox("Choose the first column to test (ie. If the first if you want to test column B against C, Type 'B'")
Loop
Col2ToTest = InputBox("Choose the second column (ie. If the first if you want to test column B against C, Type 'B'")
Do Until Col2ToTest = "A" Or Col2ToTest = "B" Or Col2ToTest = "C" Or _
Col2ToTest = "D" Or Col2ToTest = "E" Or Col2ToTest = "F" Or Col2ToTest = "G" Or _
Col2ToTest = "H" Or Col2ToTest = "I" Or Col2ToTest = "J" Or Col2ToTest = "K" Or _
Col2ToTest = "L" Or Col2ToTest = "M" Or Col2ToTest = "N" Or Col2ToTest = "O" Or _
Col2ToTest = "P" Or Col2ToTest = "Q" Or Col2ToTest = "R" Or Col2ToTest = "S"
MsgBox ("Your response is not valid, try again")
Col2ToTest = InputBox("Choose the second column (ie. If the first if you want to test column B against C, Type 'B'")
Loop
Dim Col1Num As Integer, Col2Num As Integer
'Assign numeric values to represent column letters for column 1
If Col1ToTest = "A" Then
Col1Num = 1 + 1
End If
If Col1ToTest = "B" Then
Col1Num = 2 + 1
End If
If Col1ToTest = "C" Then
Col1Num = 3 + 1
End If
If Col1ToTest = "D" Then
Col1Num = 4 + 1
End If
If Col1ToTest = "E" Then
Col1Num = 5 + 1
End If
If Col1ToTest = "F" Then
Col1Num = 6 + 1
End If
If Col1ToTest = "G" Then
Col1Num = 7 + 1
End If
If Col1ToTest = "H" Then
Col1Num = 8 + 1
End If
If Col1ToTest = "I" Then
Col1Num = 9 + 1
End If
If Col1ToTest = "J" Then
Col1Num = 10 + 1
End If
If Col1ToTest = "K" Then
Col1Num = 11 + 1
End If
If Col1ToTest = "L" Then
Col1Num = 12 + 1
End If
If Col1ToTest = "M" Then
Col1Num = 13 + 1
End If
If Col1ToTest = "N" Then
Col1Num = 14 + 1
End If
If Col1ToTest = "O" Then
Col1Num = 15 + 1
End If
If Col1ToTest = "P" Then
Col1Num = 16 + 1
End If
If Col1ToTest = "Q" Then
Col1Num = 17 + 1
End If
If Col1ToTest = "R" Then
Col1Num = 18 + 1
End If
If Col1ToTest = "S" Then
Col1Num = 19 + 1
End If
'Assign numeric values to represent column letters for column 2
If Col2ToTest = "A" Then
Col2Num = 1 + 1
End If
If Col2ToTest = "B" Then
Col2Num = 2 + 1
End If
If Col2ToTest = "C" Then
Col2Num = 3 + 1
End If
If Col2ToTest = "D" Then
Col2Num = 4 + 1
End If
If Col2ToTest = "E" Then
Col2Num = 5 + 1
End If
If Col2ToTest = "F" Then
Col2Num = 6 + 1
End If
If Col2ToTest = "G" Then
Col2Num = 7 + 1
End If
If Col2ToTest = "H" Then
Col2Num = 8 + 1
End If
If Col2ToTest = "I" Then
Col2Num = 9 + 1
End If
If Col2ToTest = "J" Then
Col2Num = 10 + 1
End If
If Col2ToTest = "K" Then
Col2Num = 11 + 1
End If
If Col2ToTest = "L" Then
Col2Num = 12 + 1
End If
If Col2ToTest = "M" Then
Col2Num = 13 + 1
End If
If Col2ToTest = "N" Then
Col2Num = 14 + 1
End If
If Col2ToTest = "O" Then
Col2Num = 15 + 1
End If
If Col2ToTest = "P" Then
Col2Num = 16 + 1
End If
If Col2ToTest = "Q" Then
Col2Num = 17 + 1
End If
If Col2ToTest = "R" Then
Col2Num = 18 + 1
End If
If Col2ToTest = "S" Then
Col2Num = 19 + 1
End If
'************CAUTION: Might be made obsolete by previous statements***********
'Step 1: Define Variables.
'Variables that contain the letters A, B, C, D,....etc.
numofletters = columnCount - 1
Dim aa As Integer
Dim LetterA As String, LetterB As String, LetterC As String
Dim LetterD As String, LetterE As String, LetterF As String
Dim LetterG As String, LetterH As String, LetterI As String
Dim LetterJ As String, LetterK As String, LetterL As String
Dim LetterM As String, LetterN As String, LetterP As String
Dim LetterQ As String, LetterR As String, LetterS As String
For aa = 2 To numofletters
If aa = 2 Then
LetterA = FormatRange.Cells(4, aa).Text
End If
If aa = 3 Then
LetterB = FormatRange.Cells(4, aa).Text
End If
If aa = 4 Then
LetterC = FormatRange.Cells(4, aa).Text
End If
If aa = 5 Then
LetterD = FormatRange.Cells(4, aa).Text
End If
If aa = 6 Then
LetterE = FormatRange.Cells(4, aa).Text
End If
If aa = 7 Then
LetterF = FormatRange.Cells(4, aa).Text
End If
If aa = 8 Then
LetterG = FormatRange.Cells(4, aa).Text
End If
If aa = 9 Then
LetterH = FormatRange.Cells(4, aa).Text
End If
If aa = 10 Then
LetterI = FormatRange.Cells(4, aa).Text
End If
If aa = 11 Then
LetterJ = FormatRange.Cells(4, aa).Text
End If
If aa = 13 Then
LetterK = FormatRange.Cells(4, aa).Text
End If
If aa = 14 Then
LetterL = FormatRange.Cells(4, aa).Text
End If
If aa = 15 Then
LetterM = FormatRange.Cells(4, aa).Text
End If
If aa = 16 Then
LetterN = FormatRange.Cells(4, aa).Text
End If
If aa = 17 Then
LetterO = FormatRange.Cells(4, aa).Text
End If
If aa = 18 Then
LetterP = FormatRange.Cells(4, aa).Text
End If
If aa = 19 Then
LetterQ = FormatRange.Cells(4, aa).Text
End If
Next aa
'**************SIGNIFICANCE TESTING: BANNER 1********************
Dim i As Integer
For i = 7 To rowCount
'if cell contains dash, treat as 0
Dim Catchdash As Variant
FormatRange.Cells(i, Col1Num).Select
Catchdash = Selection.Value
If Catchdash = "-" Then
x1 = 0
Else
x1 = Selection.Value
End If
Dim Catchdash2 As Variant
FormatRange.Cells(i, Col2Num).Select
Catchdash = Selection.Value
If Catchdash = "-" Then
x2 = 0
Else
x2 = Selection.Value
End If
FormatRange.Cells(5, Col1Num).Select
n1 = Selection.Value
FormatRange.Cells(5, Col2Num).Select
n2 = Selection.Value
x1 = x1 * 0.01
x2 = x2 * 0.01
x1Temp = x1 * (1 - x1)
x2Temp = x2 * (1 - x2)
NewTemp = (x1Temp / n1) + (x2Temp / n2)
sqrtNewTemp = NewTemp ^ (1 / 2)
TValue = Abs(x1 - x2) / sqrtNewTemp
Dim Significant As Boolean
Significant = TValue > 1.96
If Significant = True Then
FormatRange.Cells(i, Col1Num).Select
With Selection.Font
.FontStyle = "Bold"
End With
If Col2Num = 2 Then
Selection.NumberFormat = "0" & LetterA
End If
If Col2Num = 3 Then
Selection.NumberFormat = "0" & LetterB
End If
If Col2Num = 4 Then
Selection.NumberFormat = "0" & LetterC
End If
If Col2Num = 5 Then
Selection.NumberFormat = "0" & LetterD
End If
If Col2Num = 6 Then
Selection.NumberFormat = "0" & LetterE
End If
If Col2Num = 7 Then
Selection.NumberFormat = "0" & LetterF
End If
If Col2Num = 8 Then
Selection.NumberFormat = "0" & LetterG
End If
If Col2Num = 9 Then
Selection.NumberFormat = "0" & LetterH
End If
If Col2Num = 10 Then
Selection.NumberFormat = "0" & LetterI
End If
If Col2Num = 11 Then
Selection.NumberFormat = "0" & LetterJ
End If
If Col2Num = 12 Then
Selection.NumberFormat = "0" & LetterK
End If
If Col2Num = 13 Then
Selection.NumberFormat = "0" & LetterL
End If
If Col2Num = 14 Then
Selection.NumberFormat = "0" & LetterM
End If
If Col2Num = 15 Then
Selection.NumberFormat = "0" & LetterN
End If
If Col2Num = 16 Then
Selection.NumberFormat = "0" & LetterO
End If
If Col2Num = 17 Then
Selection.NumberFormat = "0" & LetterP
End If
If Col2Num = 18 Then
Selection.NumberFormat = "0" & LetterQ
End If
If Col2Num = 19 Then
Selection.NumberFormat = "0" & LetterR
End If
If Col2Num = 20 Then
Selection.NumberFormat = "0" & LetterS
End If
End If
Next i
anotherSigtest = InputBox("Do you want to do anymore significance testing? 'y' = yes")
Loop While anotherSigtest = "y"
End If 'end of of statement for significance testing