Solved

find and replace values

Posted on 2013-12-29
2
344 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
2 Comments
 

Author Comment

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

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now