Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default 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 ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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 ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Partial find and full replace



Bob, thank you so so much! Works like a charm!

*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find partial match from column A,B and fill partial match in C? Tacrier Excel Discussion (Misc queries) 4 October 24th 08 11:24 PM
Find/Replace - Full Navigation of Spreadsheet JennyW Excel Discussion (Misc queries) 2 May 22nd 06 11:59 PM
Replace a long list of abbreviations with full words in Excel jgundel Excel Worksheet Functions 3 February 7th 06 07:11 PM
Partial search and replace? Jamie Furlong Excel Discussion (Misc queries) 2 August 28th 05 03:54 PM
Partial replace Sept New Users to Excel 2 May 25th 05 09:39 AM


All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"