J
Judd Jones
I have the following list of data in column A:
1
2
1
3
1
4
1
5
1
6
The following code will select the values that I want:
Sub SELECTVALUES()
Dim c As Range
Dim d As Range
Dim FirstAddress As String
Dim myFindString As String
myFindString = "1"
With ActiveSheet.Range("A:A")
Set c = .Find(myFindString, LookIn:=xlValues, lookAt:=xlWhole)
If Not c Is Nothing Then
Set d = c
FirstAddress = c.Address
End If
Set c = .FindNext(c)
If Not c Is Nothing And c.Address <> FirstAddress Then
Do
Set d = Union(d, c)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> FirstAddress
End If
End With
d.Select
End Sub
I need help adjusting the code to selcect the data that is in columns B,C
and D instead of column A.
1
2
1
3
1
4
1
5
1
6
The following code will select the values that I want:
Sub SELECTVALUES()
Dim c As Range
Dim d As Range
Dim FirstAddress As String
Dim myFindString As String
myFindString = "1"
With ActiveSheet.Range("A:A")
Set c = .Find(myFindString, LookIn:=xlValues, lookAt:=xlWhole)
If Not c Is Nothing Then
Set d = c
FirstAddress = c.Address
End If
Set c = .FindNext(c)
If Not c Is Nothing And c.Address <> FirstAddress Then
Do
Set d = Union(d, c)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> FirstAddress
End If
End With
d.Select
End Sub
I need help adjusting the code to selcect the data that is in columns B,C
and D instead of column A.