Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Code to replace specific text

Hi

I'm wondering if anyone could advise me on this.

Within a worksheet detailing business credit card purchases, I have 2 columns which list a description of the purchase (col G) and the name of the vendor (col H)

I'm currently working on a macro that sorts the worksheet by various criteria, and I want to include in the same macro an element of tidying the data so that, if the 'description' cell says 'No Description' (this is from the credit card source data), I'd like to replace it with the content of the corresponding vendor cell:

Col G Col H
Laptop PC Store
No Description PC Store
Keyboard Amazon

becomes

Col G Col H
Laptop PC Store
PC Store PC Store
Keyboard Amazon

And I'm completely stumped on how to do it.

Any advice would be greatly appreciated.

Thanks

Steve
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Code to replace specific text

Hi Claus

Thanks very much for your reply. I have just tried it after making a couple of minor tweaks (we've inserted a couple if new columns and so it's cols I and J now, but obviously I amended the corresponding parts of your code - perhaps incorrectly).

I think I see what it's looking to do, but it's removing the top line and moving everything else up one row...

Thank you

Steve
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default Code to replace specific text

Claus,
Why not a simple Find/Replace on a user-selected range? This would only replace
the Find text with the desired text and make no other changes to the data
structure!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


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
How can I replace text with a specific number? Emma O''Shaughnessy Excel Discussion (Misc queries) 3 July 3rd 08 12:14 PM
FIND SPECIFIC TEXT AND REPLACE IT Tree Excel Worksheet Functions 5 March 27th 08 12:27 AM
Code to find and replace words inside of a text box RJR[_2_] Excel Programming 1 February 21st 07 06:38 PM
Replace text with variable using VBA replace code? Mike[_112_] Excel Programming 2 November 9th 06 06:06 PM
Replace text in specific column Gijs Breedveld Excel Programming 6 June 19th 06 07:10 PM


All times are GMT +1. The time now is 07:10 PM.

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

About Us

"It's about Microsoft Excel"