Hello,
I need to be able to select all the cells in between all the $$ (Range B3:G6). The goal is to delete them leaving any columns to the right/left or rows above/below alone.
I am currently using a "union" to select all the $$ but the range inbetween them is not selected. The range between the $$ is dynamic from one worksheet to another.
Any help would be great.
Here is an example of the table:
# |
AAA |
BBB |
CCC |
DDD |
EEE |
FFF |
AAA |
BBB |
CCC |
Time |
A |
B |
C |
D |
E |
F |
A |
B |
C |
0 |
$$ |
$$ |
$$ |
$$ |
$$ |
$$ |
27 |
64 |
88 |
0.1 |
7 |
7 |
18.12 |
0.1503 |
29.83 |
42 |
503 |
879.2 |
200 |
0.2 |
7 |
7 |
18.12 |
0.1503 |
29.83 |
42 |
503 |
879.2 |
200 |
0.3 |
$$ |
7 |
18.12 |
0.1503 |
29.83 |
42 |
503 |
879.2 |
200 |
Sub Select_Range()
Dim FindRng As Range
Dim c As Range
Dim First As String
Dim rng As Range
Set FindRng = ActiveSheet.UsedRange
With FindRng
Set c = .Find(What:="$$", After:=FindRng.Cells(1, 1), LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not c Is Nothing Then
First = c.Address
On Error Resume Next
Set rng = c
Do
Set rng = Union(rng, c)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> First
End If
rng.Select
End With
End Sub
Bookmarks