TrickyRick
New Member
- Joined
- Apr 16, 2015
- Messages
- 2
Using 2013 VBA.
I am trying to search a Range, i.e. D2:D100 for a string. String to match is a Sting Variable that changes, i.e. TktToFind = "100001-". Object is to return the Row to a Long Variable RowCount.
The Range changes so the beginning and ending are contained in string variables, i.e. BeginCell = "D2", EndCell = "D100"
The command used throws error '1004', Method 'Range' of object '_Worksheet' failed.
The Sheet containing the rows to search is set Active.
Private Sub FindRecord()
Dim RowFound As Long
RowFound = Application.WorksheetFunction.Match(TktToFind, Range(BeginCell, EndCell), 0)
Assistance is appreciated.
I am trying to search a Range, i.e. D2:D100 for a string. String to match is a Sting Variable that changes, i.e. TktToFind = "100001-". Object is to return the Row to a Long Variable RowCount.
The Range changes so the beginning and ending are contained in string variables, i.e. BeginCell = "D2", EndCell = "D100"
The command used throws error '1004', Method 'Range' of object '_Worksheet' failed.
The Sheet containing the rows to search is set Active.
Private Sub FindRecord()
Dim RowFound As Long
RowFound = Application.WorksheetFunction.Match(TktToFind, Range(BeginCell, EndCell), 0)
Assistance is appreciated.