D
David Sisson
OK this one is strange.
Used range is 831 rows.
The following code runs fine until it reaches row 804. When it errors
with Object variable or With Block Variable not set.
The row above (803) has data in it just like 804.
If I use the other method to determine rows, it only reports 803 rows.
Thanks in advance!
David
Dim MyCell As String
Dim ASheet As Worksheet
Dim Counter As Long
Dim TopRow As Range
Dim BotRow As Range
Dim NumOfRows As Long
Dim EleNum As Long
Dim A As Long
Set ASheet = Worksheets("Main Data Sheet")
'Set topCel = ASheet.Range("D6")
'Set bottomCel = ASheet.Range("D65536").End(xlUp)
'Set SourceRange = ASheet.Range(topCel, bottomCel)
'NumOfRows = SourceRange.Rows.Count + 1
NumOfRows = ASheet.UsedRange.Rows.Count
AC_ID 'assign Array to AACData
For A = 6 To NumOfRows
MyCell = Range("D" & CStr(A)).Value
If Left(MyCell, 2) = "TT" Then
EleNum = TTNum_Search_2(MyCell)'Returns element# of array.
If EleNum <> 0 Then
ASheet.Range("D" & CStr(A)).Comment.Text _
(AACData(EleNum)(1))
ASheet.Range("D" & _
CStr(A)).Comment.Shape.TextFrame._
Characters.Font.Size = 16
End If
End If
Next
Used range is 831 rows.
The following code runs fine until it reaches row 804. When it errors
with Object variable or With Block Variable not set.
The row above (803) has data in it just like 804.
If I use the other method to determine rows, it only reports 803 rows.
Thanks in advance!
David
Dim MyCell As String
Dim ASheet As Worksheet
Dim Counter As Long
Dim TopRow As Range
Dim BotRow As Range
Dim NumOfRows As Long
Dim EleNum As Long
Dim A As Long
Set ASheet = Worksheets("Main Data Sheet")
'Set topCel = ASheet.Range("D6")
'Set bottomCel = ASheet.Range("D65536").End(xlUp)
'Set SourceRange = ASheet.Range(topCel, bottomCel)
'NumOfRows = SourceRange.Rows.Count + 1
NumOfRows = ASheet.UsedRange.Rows.Count
AC_ID 'assign Array to AACData
For A = 6 To NumOfRows
MyCell = Range("D" & CStr(A)).Value
If Left(MyCell, 2) = "TT" Then
EleNum = TTNum_Search_2(MyCell)'Returns element# of array.
If EleNum <> 0 Then
ASheet.Range("D" & CStr(A)).Comment.Text _
(AACData(EleNum)(1))
ASheet.Range("D" & _
CStr(A)).Comment.Shape.TextFrame._
Characters.Font.Size = 16
End If
End If
Next