I have some code that counts how many rows of interest there are in a spreadsheet and I want it to assign numbers as variable to those rows. e.g. The used range is B12:L19 (8 rows) and I want to assign row 12 as 1, row 13 as 2, row 14 as 3, etc so that later in my code I can reference that number is a msgbox and display a comment in my sheet. The code I have is posted below. The lines in red are what I am having trouble with and how I am trying to use it later in my code. Any help is appreciated.
Code:
Sub DropStandard()
On Error GoTo Errhandler
Dim i, x, StdCount As Integer, NumStd() As String
Set InfoBox = CreateObject("WScript.Shell")
AckTime = 5
Application.ScreenUpdating = False
EnzymeCurve.Activate
For i = 1 To 25
If Range("B" & i).Text Like "Working standards" Then
Debug.Print i
StdCount = EnzymeCurve.Range(EnzymeCurve.Range("K" & i + 2), EnzymeCurve.Range("K" & i + 2).End(xlDown)).Rows.Count
For x = 1 To StdCount
If IsEmpty(Range("K" & i + 2)) = True Then
Exit Sub
Else
[COLOR=#ff0000]NumStd(x) = x[/COLOR]
End If
Next x
Exit For
End If
Debug.Print i
Next i
EnzymeCurve.Range("B7").Activate
Application.ScreenUpdating = True
Exit Sub
''''''''Formats Graph'''''''''''''''
DropOneStandard:
Range("N12:AJ22").ClearContents
Range("B19:L19").Select
With Selection.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.399945066682943
End With
[COLOR=#ff0000]Select Case InfoBox.Popup("W" & NumStdx & " excluded from standard curve.", AckTime, "Information", 0)
Case 1, -1
End Select
Range("B22").Value = "*W" & NumStdx & " excluded from standard curve."[/COLOR]
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.FullSeriesCollection(1).XValues = "='Enzyme Curve'!$G$12:$G$18"
ActiveChart.FullSeriesCollection(1).Values = "='Enzyme Curve'!$J$12:$J$18"
ActiveChart.FullSeriesCollection(2).XValues = "='Enzyme Curve'!$G$19"
ActiveChart.FullSeriesCollection(2).Values = "='Enzyme Curve'!$J$19"
ActiveChart.FullSeriesCollection(2).MarkerStyle = xlMarkerStyleX
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.FullSeriesCollection(2).Select
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent2
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
End With
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.ChartArea.Copy
QuadraticWork.Select
Range("J15").Select
ActiveSheet.Paste
ActiveChart.FullSeriesCollection(1).Trendlines(1).Select
With Selection
.Type = xlPolynomial
.Order = 2
End With
Range("C5:E5").ClearContents
Range("C5").FormulaR1C1 = "=LINEST('Enzyme Curve'!R12C10:R18C10,'Enzyme Curve'!R12C7:R18C7^{1,2})"
Range("C5:E5").FormulaArray = _
"=LINEST('Enzyme Curve'!R12C10:R18C10,'Enzyme Curve'!R12C7:R18C7^{1,2})"
Range("J12:M12").Select
With Selection.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.399945066682943
End With
Range("B7").Activate
Exit Sub
''''''''''Error handler to log and report issue to user'''''''''''''
Errhandler:
ErrorLine = Erl
strModule = Application.VBE.ActiveCodePane.CodeModule: Debug.Print strModule
Set CodeMod = Application.VBE.ActiveCodePane.CodeModule
With CodeMod
LineNum = .CountOfDeclarationLines + 1
Do Until LineNum >= .CountOfLines
ProcName = .ProcOfLine(LineNum, ProcKind)
LineNum = .ProcStartLine(ProcName, ProcKind) + _
.ProcCountLines(ProcName, ProcKind) + 1
Loop
End With
Call ErrorHandler.ErrorHandler
End Sub