Guest User

Untitled

a guest
Oct 18th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. Sub FindPhrase()
  2. Dim i As Long, searchCol As Long, dCell As Range, ws As Worksheet
  3.  
  4. Set ws = ActiveSheet
  5.  
  6. 'column A
  7. searchCol = 1
  8.  
  9. 'output cell
  10. Set dCell = ws.Range("B1")
  11.  
  12. 'search through cells in specified column
  13. For i = 1 To ws.Cells(ws.Rows.Count, searchCol).End(xlUp).Row
  14. If InStr(ws.Cells(i, searchCol), "The cpu utilization is ") > 0 And InStr(ws.Cells(i, searchCol), "%") > 0 Then
  15. dCell.Value = CDbl(Replace(Mid(ws.Cells(i, searchCol), InStr(ws.Cells(i, searchCol), "%") - 2, 2), "%", ""))
  16. Exit For
  17. End If
  18. Next i
  19.  
  20. End Sub
Add Comment
Please, Sign In to add comment