gtd526
Well-known Member
- Joined
- Jul 30, 2013
- Messages
- 660
- Office Version
- 2019
- Platform
- Windows
Hello,
How can I select the cell or offset from foundRng?
The code and data are below.
Thanks.
How can I select the cell or offset from foundRng?
The code and data are below.
Thanks.
VBA Code:
Sub Test2()
'select the entire range that contains "Parlay"
'gives the cell address of "Parlay"
'works
Dim foundRng As Range
LastRow = Cells(Rows.Count, "B").End(xlUp).Row 'last row according to "B"
LastRow2 = Cells(Rows.Count, "C").End(xlUp).Row 'last row according to "C"
Range("E" & LastRow).Select 'have to select lastRow to select correct range regarding line below
'Range(Selection, Intersect(Selection.EntireColumn, Rows(LastRow2))).Select
Set foundRng = Range(Selection, Intersect(Selection.EntireColumn, Rows(LastRow2))).Find("Parlay")
'Range("E" & foundRng.Address).Select 'want to select or offset from foundRng address
If foundRng Is Nothing Then
MsgBox "Value not found"
Else
MsgBox foundRng.Address
End If
End Sub
Wagers.xlsm | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | |||
1 | 0 | #REF! | NFL | SPRD | $ 5.00 | $ 4.35 | TB | |||
2 | #N/A | NFL | Parlay | $ 5.00 | $ 4.00 | |||||
3 | #N/A | |||||||||
4 | #N/A | |||||||||
5 | ||||||||||
6 | #REF! | Balance | ||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
B1 | B1 | =#REF!+8-WEEKDAY(#REF!) |
A1:A2 | A1 | =INDEX('[NFL.xlsm]Weekly Picks'!$D$4:$D$35,MATCH($H1,'[NFL.xlsm]Weekly Picks'!$A$4:$A$35,0)) |
G3:G4 | G3 | =INDEX('[NFL.xlsm]Weekly Picks'!$E$4:$E$35,MATCH($H3,'[NFL.xlsm]Weekly Picks'!$A$4:$A$35,FALSE)) |
C6 | C6 | =#REF!+K5 |