I have a cell that keeps adding 'sections' to the cell based on user activity, with the most recent on top, (so duplicates can occur). An example of one of the cells is:
STATUS: PRELOAD ERROR: :
NOTE: N/A
BY: SMITH, JOHN
AT: 3/20/2020 2:45:37 PM
----------------------------------------
STATUS: PRELOAD ERROR: GPS PRELOAD IS MISSING: GPS
NOTE: EMPLOYEE DEAL
BY: SMITH, JOHN
AT: 3/20/2020 2:45:37 PM
----------------------------------------
STATUS: PRELOAD ERROR: PRELOAD IS MISSING: THEFT
NOTE: EMPLOYEE DEAL
BY: SMITH, JOHN
AT: 3/20/2020 2:45:37 PM
----------------------------------------
STATUS: PRELOAD ERROR: PRELOAD IS MISSING: APPERANCE
NOTE: EMPLOYEE DEAL
BY: SMITH, JOHN
AT: 3/20/2020 2:45:37 PM
----------------------------------------
STATUS: CLEANED
NOTE: PRINTED RECAP SHEET
BY: SMITH, JOHN
AT: 3/20/2020 2:45:37 PM
----------------------------------------
STATUS: HOUSE DEAL ENTRY
NOTE: EMPLOYEE DEAL
BY: SMITH, JOHN
AT: 3/20/2020 2:44:54 PM
----------------------------------------
STATUS: CLEANED
NOTE: PRINTED RECAP SHEET
BY: SMITH, JOHN
AT: 3/20/2020 2:44:54 PM
----------------------------------------
I want to be able to extract the most recent "STATUS: HOUSE DEAL ENTRY" section which would include the 3 lines after it. The result should be:
STATUS: HOUSE DEAL ENTRY
NOTE: EMPLOYEE DEAL
BY: SMITH, JOHN
AT: 3/20/2020 2:44:54 PM
how can I do it with VBA or is it possible with an Excel formula?
Thanks in advance!
I figured it out.
Dim StatusHistory As String
Dim FindHouse() As String
StatusHistory = FILOGData.Range("T1277").Value
FindHouse = Split(StatusHistory, " ---------------------------------------- ")
For i = 0 To UBound(FindHouse)
If InStr(FindHouse(i), "STATUS: HOUSE DEAL ENTRY") > 0 Then
MsgBox FindHouse(i)
End If
Next i
Thoughts?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.