Solved

find and replace values

Posted on 2013-12-29
2
358 Views
Last Modified: 2013-12-30
folks

based on a value in sheet 1 field b1 I would like to loop thru sheet 2 the entire column "a" and find and replace values containing "car" with  the word "transport"
if sheet 1 b1 = 1 then replace values that are months with seaons

i.e

if sheet 1 b1 = "1"

the replace "car" with  "transport"

if

if sheet 1 b1 = "2"

the replace "snacks" with  "food"

if sheet 1 b1 = "3"

the replace "pills" with  "medicine"
0
Comment
Question by:rutgermons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:rutgermons
ID: 39745158
I guess substitute may be the better term used for this
0
 
LVL 70

Accepted Solution

by:
Qlemo earned 500 total points
ID: 39745297
In Excel VBA:
Sub SubstA()
  strFind = ""
  strRepl = ""
  Select Case [Sheet1!B1].Value
    Case 1: strFind = "car": strRepl = "transport"
    Case 2: strFind = "snacks": strRepl = "food"
    Case 3: strFind = "pills": strRepl = "medicine"
  End Select
  [Sheet2!A:A].Replace strFind, strRepl, xlWhole
End Sub

Open in new window

Calling that sub (macro) should perform that simple task.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question