J
Jonathan
Hello.
The code below works correctly except I need it to determine if a string
begins with another string stored in an array, not contains the string
stored in the array. For example
If the data is Should return Actually Returns
112 112 112
201 115 201
115 183 115
183 183
254
390
here is the code that I have modified so far from another posting here.
Dim rng As Range, cell As Range, arrVar As Variant
Dim strAddress1 As String, rngUnion As Range
Set rng = Range("Main!c:c")
For Each arrVar In Array("1", "2")
Set cell = rng.Find(arrVar, LookIn:=xlValues, Lookat:=xlPart,
MatchCase:=True)
If Not cell Is Nothing Then
strAddress1 = cell.Address
Do
If rngUnion Is Nothing Then
Set rngUnion = cell
Else
Set rngUnion = Union(cell, rngUnion)
End If
Set cell = rng.FindNext(cell)
Loop While Not cell Is Nothing And _
cell.Address <> strAddress1
End If
Next arrVar
If Not rngUnion Is Nothing Then
rngUnion.EntireRow.Copy
End If
Any help would be appreciated.
Thanks
Jonathan
The code below works correctly except I need it to determine if a string
begins with another string stored in an array, not contains the string
stored in the array. For example
If the data is Should return Actually Returns
112 112 112
201 115 201
115 183 115
183 183
254
390
here is the code that I have modified so far from another posting here.
Dim rng As Range, cell As Range, arrVar As Variant
Dim strAddress1 As String, rngUnion As Range
Set rng = Range("Main!c:c")
For Each arrVar In Array("1", "2")
Set cell = rng.Find(arrVar, LookIn:=xlValues, Lookat:=xlPart,
MatchCase:=True)
If Not cell Is Nothing Then
strAddress1 = cell.Address
Do
If rngUnion Is Nothing Then
Set rngUnion = cell
Else
Set rngUnion = Union(cell, rngUnion)
End If
Set cell = rng.FindNext(cell)
Loop While Not cell Is Nothing And _
cell.Address <> strAddress1
End If
Next arrVar
If Not rngUnion Is Nothing Then
rngUnion.EntireRow.Copy
End If
Any help would be appreciated.
Thanks
Jonathan