Help!
I have a portion of the code giving me problems below. The red code line below is throwing an Error I cannot find
Error message: "Run-time error '91': Object variable or With block variable not set"
All names match, all entities identify as the code is running until this step.
Can anyone point me in the right direction?
Set frVS08EC1FTS = TBViaS08EC1FTS.Find(what:=celVS08EC1FTS.Value, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
I have a portion of the code giving me problems below. The red code line below is throwing an Error I cannot find
Error message: "Run-time error '91': Object variable or With block variable not set"
All names match, all entities identify as the code is running until this step.
Can anyone point me in the right direction?
Set frVS08EC1FTS = TBViaS08EC1FTS.Find(what:=celVS08EC1FTS.Value, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
VBA Code:
Sub ViabSurf08_ECAs_FTS_Thing()
Dim EMW1, Part1 As Workbook
Dim Ws1, Ws2b As Worksheet
Dim ViabSurf08_ECA1_FTS, ViabSurf08_ECA2_FTS, ViabSurf08_ECA3_FTS, ViabSurf08_ECA4_FTS, ViaS08ECA1FTS, ViaS08ECA2FTS, ViaS08ECA3FTS, ViaS08ECA4FTS As ListObject
'Dim CViaS08ECA1FTS, CViaS08ECA2FTS, CViaS08ECA3FTS,, CViaS08ECA4FTS As ListColumn
Dim TBViaS08EC1FTS, TBViaS08EC2FTS, TBViaS08EC3FTS, TBViaS08EC4FTS, celVS08EC1FTS, celVS08EC2FTS, celVS08EC3FTS, celVS08EC4FTS, frVS08EC1FTS, frVS08EC2FTS, frVS08EC3FTS, frVS08EC4FTS As Range
Dim oNewRow As ListRow
Dim AdVS08EC1FTS, AdVS08EC2FTS, AdVS08EC3FTS, AdVS08EC4FTS As String
Set EMW1 = Workbooks("Environmental Monitoring v0.5b.xlsm")
With EMW1
Set Ws1 = .Sheets("Viable FingerTip-Sleeve")
Set ViabSurf08_ECA1_FTS = Ws1.ListObjects("ISO8G_ViableSurf_ECA1_FTS")
Set ViabSurf08_ECA2_FTS = Ws1.ListObjects("ISO8G_ViableSurf_ECA2_FTS")
Set ViabSurf08_ECA3_FTS = Ws1.ListObjects("ISO8G_ViableSurf_ECA3_FTS")
Set ViabSurf08_ECA4_FTS = Ws1.ListObjects("ISO8G_ViableSurf_ECA4_FTS")
End With
With ViabSurf08_ECA1_FTS
Set TBViaS08EC1FTS = .ListColumns("Test Date").DataBodyRange
End With
With ViabSurf08_ECA2_FTS
Set TBViaS08EC2FTS = .ListColumns("Test Date").DataBodyRange
End With
With ViabSurf08_ECA3_FTS
Set TBViaS08EC3FTS = .ListColumns("Test Date").DataBodyRange
End With
With ViabSurf08_ECA4_FTS
Set TBViaS08EC4FTS = .ListColumns("Test Date").DataBodyRange
End With
Set Part1 = Workbooks("Viables_Test.xlsx")
With Part1
Set Ws2b = .Sheets("Viable FingerTip-Sleeve")
With Ws2b
Set ViaS08ECA1FTS = .ListObjects("ECA1_T1_ViaSurf_FTS")
Set ViaS08ECA2FTS = .ListObjects("ECA2_T1_ViaSurf_FTS")
Set ViaS08ECA3FTS = .ListObjects("ECA3_T1_ViaSurf_FTS")
Set ViaS08ECA4FTS = .ListObjects("ECA4_T1_ViaSurf_FTS")
End With
End With
With ViaS08ECA1FTS
Set CViaS08ECA1FTS = .ListColumns("Test Date").DataBodyRange
End With
With ViaS08ECA2FTS
Set CViaS08ECA2FTS = .ListColumns("Test Date").DataBodyRange
End With
With ViaS08ECA3FTS
Set CViaS08ECA3FTS = .ListColumns("Test Date").DataBodyRange
End With
With ViaS08ECA4FTS
Set CViaS08ECA4FTS = .ListColumns("Test Date").DataBodyRange
End With
' Copy the ECA 1 Finger Tip and Sleeve Viable TI columns
For Each celVS08EC1FTS In CViaS08ECA1FTS
'something is up!!!
Set frVS08EC1FTS = TBViaS08EC1FTS.Find(what:=celVS08EC1FTS.Value, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
'AdVS08EC1FTS = celVS08EC1FTS.Address
If Not frVS08EC1FTS Is Nothing Then
If frVS08EC1FTS.Cells(, 2) = "" Then
frVS08EC1FTS.Cells(, 2) = celVS08EC1FTS.Offset(, 2).Value
End If
End If
If frVS08EC1FTS Is Nothing Then 'meaning it was not found
AdVS08EC1FTS = celVS08EC1FTS.Address
With ViabSurf08_ECA1_FTS
Set oNewRow = .ListRows.Add
With oNewRow.Range
If .Cells(, 1).Value = celVS08EC1FTS.Offset(, 0).Value Then
.Cells(, 2) = celVS08EC1FTS.Offset(, 2).Value
.Cells(, 3) = celVS08EC1FTS.Offset(, 3).Value
Else
.Cells(, 1).Value = celVS08EC1FTS.Offset(, 0).Value
.Cells(, 2) = celVS08EC1FTS.Offset(, 2).Value
.Cells(, 3) = celVS08EC1FTS.Offset(, 3).Value
End If
End With
End With
End If
Next celVS08EC1FTS