Replace Multiple Cells

collegeguy

New Member
Joined
Jun 22, 2011
Messages
2
Hello everyone...here is my situation.

I'm trying to replace several words in a spreadsheet to match only one value. For example, when I attend an event and prospects enter that they are interested in either nursing, practical nursing, nurse or rpn, I would like those values to be changed to Nursing - Practical to match the data in my CRM before importing.

I've tried a few VBA codes but keep getting errors. I am using office 2007. Here is one that I've tried:

Sub ReplaceCellValues()
For Each Cell In Range("A1:A11")
If Cell = Nursing Then Cell.Value = Practical - Nursing
If Cell = rpn Then Cell.Value = Practical - Nursing
If Cell = Nurse Then Cell.Value = Practical - Nursing
If Cell = Practical Then Cell.Value = Practical - Nursing
Next
End Sub

I took computer programming in college 11 years ago and haven't used it since. Any help would be appreciated.

Thank you
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi
i think u want to replace nursing,practical nursing,nurse or rpn as "Nursing - Practical" to enter the data in CRM
Try :
Code:
Sub test()
Results = Array("practical nursing", "nurse or rpn", "nursing")
For P = 0 To UBound(Results)
    Columns("A:A").Replace What:=Results(P), Replacement:="Nursing - Practical", LookAt:=xlWhole, _
                              SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
                              ReplaceFormat:=False
      Next
End Sub
 
Upvote 0
Thank you Maheshp, that did help but it only changed the word nursing.

Essentially what I have is a spread sheet with prospective students names, emails, phone number and then they enter what career field they are interested in. I capture this information using number on an iPad. Unfortunately, no software on the iPad allows you to use drop down lists so I'm trying to create a code or macro that will search through everyone's entry and match them to what I have in my CRM. Nursing is an example. Another is our business programs, some students type in accounting or accountant but in our CRM it's listed as Business - Accounting.

Up until now I've been going through the sheets manually and updating them but it would be nice to be able to run something that would go through and change everything automatically.
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,919
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top