You are here:

Excel/Loop Through A String

Advertisement


Question
I would like to loop through a string in a cell and change the letter "A" to the Number "3".
Can this be done with a macro?

Thanks

Answer
Hi Jim,

You can use the Find replace function.
Select the cell and hit the Keys Ctrl & H to open the Find Replace Dialog Box.
Place A in the find box and 3 in the replace box. Then hit replace.

You can use code as well.

   Range("A1").Replace What:="a", Replacement:="3", LookAt:=xlPart, _
       SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
       ReplaceFormat:=False

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Dave Morrison

Expertise

I can answer most excel questions My Website is davesexcel.com

Experience

I have been working with spreadsheets since 1991. I am a self-trained excel developer since 2005.

Publications
My website davesexcel.com

Education/Credentials
Business admin. U of R.

Awards and Honors
Microsoft Excel MVP 2011-2012

©2016 About.com. All rights reserved.