Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Another Find and Replace need

I've searched forum...and have not been able to find a solution. I believe
its quite simple...but beyond my capability.

I would like to search thru column B for all cell values that equals "modify".

If Found, I would like to remove the trailing "i" or "c" in Column C in same
row.
(i.e. change 51005674i to 51005674)
(or change 50004421c to 50004421)

I'd like it to search all rows in worksheet.

I appreciate any help.

Steve




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Another Find and Replace need

Hi Steve

Try the below which works on the active sheet

Sub Macro()
Dim varFound As Variant, strAddress As String
With ActiveSheet.Range("B:B")
Set varFound = .Find("modify", LookIn:=xlValues, Lookat:=xlWhole)
If Not varFound Is Nothing Then
strAddress = varFound.Address
Do
varFound.Offset(, 1) = Val(varFound.Offset(, 1).Text)
Set varFound = .FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address < strAddress
End If
End With
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Steve K" wrote:

I've searched forum...and have not been able to find a solution. I believe
its quite simple...but beyond my capability.

I would like to search thru column B for all cell values that equals "modify".

If Found, I would like to remove the trailing "i" or "c" in Column C in same
row.
(i.e. change 51005674i to 51005674)
(or change 50004421c to 50004421)

I'd like it to search all rows in worksheet.

I appreciate any help.

Steve




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Another Find and Replace need

Jacob - Your the best ! It work perfectly ! Thanks much for your time and
help!!!

Steve

"Jacob Skaria" wrote:

Hi Steve

Try the below which works on the active sheet

Sub Macro()
Dim varFound As Variant, strAddress As String
With ActiveSheet.Range("B:B")
Set varFound = .Find("modify", LookIn:=xlValues, Lookat:=xlWhole)
If Not varFound Is Nothing Then
strAddress = varFound.Address
Do
varFound.Offset(, 1) = Val(varFound.Offset(, 1).Text)
Set varFound = .FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address < strAddress
End If
End With
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Steve K" wrote:

I've searched forum...and have not been able to find a solution. I believe
its quite simple...but beyond my capability.

I would like to search thru column B for all cell values that equals "modify".

If Found, I would like to remove the trailing "i" or "c" in Column C in same
row.
(i.e. change 51005674i to 51005674)
(or change 50004421c to 50004421)

I'd like it to search all rows in worksheet.

I appreciate any help.

Steve




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 and Replace - Replace with Blank Space Studebaker Excel Discussion (Misc queries) 4 April 3rd 23 10:55 AM
Find/Replace Event or Find/Replace for Protected Sheet ... Joe HM Excel Programming 2 October 27th 07 03:55 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
Using Find and Replace to replace " in a macro snail30152 Excel Programming 1 April 13th 06 11:58 PM
Replace method - cannot find any data to replace Mike Excel Programming 5 April 6th 06 08:56 PM


All times are GMT +1. The time now is 10:29 AM.

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"