sunilbsrv2k
Board Regular
- Joined
- May 25, 2018
- Messages
- 73
Hi,
I am trying to get the address of a cell with a certain criteria, which will be starting cell of the range; one more cell with another criteria will be end point in the range.
The addresses of these are successfully obtained, but when I use them in range function, its giving error. Please help:
I am trying to get the address of a cell with a certain criteria, which will be starting cell of the range; one more cell with another criteria will be end point in the range.
The addresses of these are successfully obtained, but when I use them in range function, its giving error. Please help:
VBA Code:
Sub chkselect()
Dim rng As Range
Dim i As Range
Dim srng, erng
Set rng = Sheet1.Range("C3:Z3")
For Each i In rng
If i & i.Offset(-1, 0) = "202035" Then
srng = i.Address
End If
Next
For Each j In rng
If j & j.Offset(-1, 0) = "202052" Then
erng = j.Address
End If
Next
cells(Range(i):Range(j)).copy
End Sub