View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default DIY Excel Marco Beginner needs help with 'replace'

No need to apologize. I now see that you have a translation table (two
columns) and you would like to use it to translate supplied data:

starting with:

a happy dog
a sad cat
Kingsmill White
Own Label

it would produce:

a happy dog
a sad cat
Kingsmill
Own Label

So it would go down the list and, for each item in the list, see if
translation is possible. If translation was possible, it would perform it.
Thus in the example, the only translation would be from:

Kingsmill White to Kingsmill

Look for an update tomorrow !!
--
Gary''s Student


"Greg" wrote:

Sorry. I apologise for any confusion. It is really difficult to
describe what I want on a messaging board.

From: Gary''s Student - view profile
Date: Sat, May 27 2006 4:23 pm
Email: Gary''s Student
Groups: microsoft.public.excel.programming
Not yet ratedRating:
show options


Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Report Abuse | Find messages by this author


I am not certain what you want the macro to do. From your posting:

A B
Hovis Hovis
Hovis White Hovis
Hovis White Standard Hovis
Kingsmill Kingsmill
Kingsmill White Kingsmill
Kingsmill White Standard Kingsmill
Own Label Own Label
Own Label White Own Label
Own Label White Standard Own Label
The Enjoy Collection White The Enjoy Collection

I've added two more variables here that I have, that I would like to
change. I simply want to make an all encompassing macros that I could
add to a sheet, as an icon. This icon I would then click and it would
change all the names to how I want them. I have been using this code,
but it means replicating it for every single cell that i want:

FormulaR1C1 = _
"Hovis"
Cells.Replace What:="Hovis White", Replacement:="Hovis",
LookAt:=xlWhole _
, SearchOrder:=xlByColumns, MatchCase:=True,
SearchFormat:=False, _
ReplaceFormat:=False
Range("A11").Select

So then I would have to repeat this for every cell and every
differentiation to the full name. Is there not a simple way of using a
range of cell, e.g. (and this example of script doesn't work)

FormulaR1C1 = _
"Hovis"
Cells.Replace What:="Hovis *", Replacement:="Hovis",
LookAt:=xlWhole _
, SearchOrder:=xlByColumns, MatchCase:=True,
SearchFormat:=False, _
ReplaceFormat:=False
Range("A1:A100").Select

Is there no way of making this work? Is there a way to amend the
script.

I'm really sorry, I'm not macros savvy, I have been DIY'ing it for like
4 days and I can't seem to identify a way to do it, but I know it can
work for what I want. The help is no help at all in Excel!!!


I hope your weekend is going well, I apologise for not being able to be
concise. I hope you can help me. thank you for your patience and
efforts so far, it is much appreciated.