![]() |
Partial find and full replace
Hi there,
Im looking for VB that will look in column U for any instance of "abc" and when it finds it replace the entire cell contents with nothing. Thus for eg in cell u2 I have a value abc(if,d2-3,z,y) after the macro runs I need to have the cell be blank. (ie delete the abc and everything after it..) abc is always the first three letters in the cell. Any ideas..? Thanks D *** Sent via Developersdex http://www.developersdex.com *** |
Partial find and full replace
Public Sub ProcessData()
Const TEST_COLUMN As String = "U" '<=== change to suit Dim i As Long Dim iLastRow As Long With ActiveSheet iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row For i = iLastRow To 1 Step -1 If .Cells(i, TEST_COLUMN).Value Like "abc*" Then .Cells(i, TEST_COLUMN).Value = "" End If Next i End With End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Darin Kramer" wrote in message ... Hi there, Im looking for VB that will look in column U for any instance of "abc" and when it finds it replace the entire cell contents with nothing. Thus for eg in cell u2 I have a value abc(if,d2-3,z,y) after the macro runs I need to have the cell be blank. (ie delete the abc and everything after it..) abc is always the first three letters in the cell. Any ideas..? Thanks D *** Sent via Developersdex http://www.developersdex.com *** |
Partial find and full replace
Bob, thank you so so much! Works like a charm! *** Sent via Developersdex http://www.developersdex.com *** |
All times are GMT +1. The time now is 06:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com