Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Replace cell of column with cell of other workbook

Hello,

I have the following problem.
In one sheet I have a table with imported keys from an
access table.
Now I want to replace these keys with strings that are in
a second worksheet. So eg when a cell in the 1st sheet
has value 2 it has to be replaced by eg "the second"...

How can I do this for all the cells of that column
automatically?

Thanks a lot.

Kristof
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Replace cell of column with cell of other workbook

This is one of those cases where doing it with the macro
recorder turned on allows you to see quite easily how to
do this. Review the code, then simply edit it to make it
more applicable generally.
Here's the result of my record & adjustment:

Sub Macro1()
Dim ReplaceWhat As String
Dim ReplaceWith As String
Dim SearchCol As String

ReplaceWhat = "Test"
ReplaceWith = "NewStuff"
SearchCol = "B"


Columns(SearchCol).Replace What:=ReplaceWhat,
Replacement:=ReplaceWith, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

End Sub

Patrick Molloy
Microsoft Excel MVP




-----Original Message-----
Hello,

I have the following problem.
In one sheet I have a table with imported keys from an
access table.
Now I want to replace these keys with strings that are

in
a second worksheet. So eg when a cell in the 1st sheet
has value 2 it has to be replaced by eg "the second"...

How can I do this for all the cells of that column
automatically?

Thanks a lot.

Kristof
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Replace cell of column with cell of other workbook

Multiposted in misc + newusers + programming + worksheet.functions.
Aarrgghhhh!!!!


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
to replace a value in each cell of a column pol Excel Discussion (Misc queries) 3 May 22nd 09 09:43 AM
to replace a value in each cell of the column pol Excel Discussion (Misc queries) 6 May 21st 09 03:16 PM
linked workbook cell returns 0 is source workbook cell is blank? Syd[_2_] Excel Worksheet Functions 4 April 13th 09 07:49 PM
Can I replace a ' at the beginning of a text cell using Replace Hilde Excel Discussion (Misc queries) 4 September 10th 07 06:22 PM
Excel - create button to replace cell content with cell value blackmot Excel Worksheet Functions 3 December 7th 05 05:10 PM


All times are GMT +1. The time now is 11:13 AM.

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"