Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


Find, Replace Quotation Marks In Vba

I'm trying to find and replace all the quotation marks (basically just deleting them) on a worksheet through VBA. I've tried a number of things and am stumped. The code I'm using is:

Cells.Replace What:="", Replacement:="", LookAt:=xlPart, MatchCase:=False 'Replaces the quotes.

I've tried

Cells.Replace What:=" & chr(34) & ", Replacement:="", LookAt:=xlPart, MatchCase:=False 'Replaces the quotes.


Cells.Replace What:=""", Replacement:="", LookAt:=xlPart, MatchCase:=False 'Replaces the quotes.

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
Find And Delete Quotation Marks At The End Of A String
I'm using a query that dumps information into Excel. The query automatically creates a formula in each each cell. For instance if the first value in the query showed FUNSTUFF, after dumping it into Excel, the contents of the cell would show ="FUNSTUFF". I can just use a find and replace to get rid of the leading =", but sometimes the values of the cells are supposed to have a quotation mark, so using the same method to remove the trailing quote won't work. I need a way to search each cell, check if the last character in the string is a quote, and if it is, delete it.

View Replies!   View Related
Handle Quotation Marks Within Text VBA Is Working On
I have a macro that imports xml and then allows the user to update certain fields. The XML contains many quotation marks and inbound I deal with this by replacing " with ' using Find & Replace.

But before exporting the XML again I need to replace the ' with " but am stuck on how to do this.

For instance I'm trying the following with no success:

Cells.Replace What:="'", Replacement:=""", LookAt:=xlPart" _
, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

View Replies!   View Related
Quotation Marks Causing Error
The IF formula works if placed in a cell, but Vba doesn't seem to like the Quotation Marks in Rc11="".

View Replies!   View Related
To Insert A Variable Between Quotation Marks
I have the following line of
Selection.AutoFilter Field:=1, Criteria1:="=2009_15", Operator:=xlAnd

The highlighted portion is going to change from week to week. I have never been able to put a variable inside of quotation marks. I am sure it is simple, which explains why it is out of my mental grasp. how I can assign a variable in there?

View Replies!   View Related
Numerical Treatment Of Quotation Marks
To prevent the display of values in a worksheet, I have used an If statement in the format: =IF(I67=""",""",I67). This generally works well; however, I have discovered that if the input value for I67 is actually zero, there is no value displayed in the cell. I need the value to be displayed as a numerical zero so that it can be used in subsequent calculations.

View Replies!   View Related
Text File Importing With Double Quotation Marks
I am having a problem with the correct coding needed for a qotation mark

i wish to place a quotation mark around some text with coding
example "TEST" by using the code below this appears fine and looks fine when i save the file, however when i open that file in a .txt file i see """TEST"""

This is the coding i am using and can see it may be where the problem lies

ActiveSheet. Range("C4").Value = """" & Sheets("PRODUCTS").Range("Y1").Value & """"

to correct it i have tried this

ActiveSheet.Range("C4").Value = " & Sheets("PRODUCTS").Range("Y1").Value & "

View Replies!   View Related
Quotes/Quotation Marks In Formula Macro Code
how do i put a formula using: activecell.formula"=CODE("A")"

with " in it
it just dosent work

and is there a way to use the returned value of these formulee in macros with out actually putting them into a cell

View Replies!   View Related
Correct Way To Reference A Question Mark And A Period (Apostrophes And Quotation Marks)
This question is about punctuation.

I know the following is a correct way to reference a question mark and a period....

View Replies!   View Related
Find Last Character In A String Is A Quotation Mark?
How do you find if the last character in a string is a quotation mark?

View Replies!   View Related
Find & Replace In VBA
I am trying to find and replace #N/A from a formula (link to another sheet) with nothing in the cell, using VBA.

Using this code it will do the first "find"
Cells.Find(What:="#N/A", After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
True, SearchFormat:=False).Activate
Trying this
Cells.Replace What:="#N/A", Replacement:=" ", LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=True, _
LookIn:= is highlighted and I get a "named argument not found"
Don't understand that because LookIn:=xlValues works in the first code.

I did try and place After:=ActiveCell,before this, but that does not work. I Get the same error.

I have more then one cell with the #N/A which I would like to get rid of. I want this to work only on this one sheet. The other sheet that the formula is pulling from does have #N/A, and that is okay, I need it there.

View Replies!   View Related
VBA Code For Find And Replace A Particular Phrase
I am trying to write a code for VBA code for find and replace, I want to find a particular phrase (i.e. 1. Value Added Processing) which is all in one cell and replace it a range of cells of other cells which is contained on a different sheet.

So basically the original 1 cell would be replaced for anywhere between 1 to 20cells. Depending upon what I type in.

Worksheets(1).Range("B2:B50").Replace What:="1.ValueAddedProcessing", Replacement:= _
"Sheet1!A1:A11", LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False

View Replies!   View Related
VBA Macro To Find And Replace In Word
The error is a Run-Time 450 (Too many arguments or invalid property assignment), when I click debug it highlights With Selection.Find

Sub TestTemplates()
Dim s1 As String
Dim s2 As String
Dim s3 As String
Dim appWD As Object
Set appWD = CreateObject("Word.Application")

s1 = ActiveSheet.Range("Name")
s2 = ActiveSheet.Range("Add1")
s3 = ActiveSheet.Range("Add2")

appWD.Visible = True
appWD.Documents.Open Filename:="C:UsersRemy LabueDocumentsCareCore WorkTest Letter TemplatesTest Letter 1.DOCX"

Call DoFindReplace(FindText:="(1)", ReplaceText:=s1)...................

View Replies!   View Related
VBA Code For Find And Replace (male/female To M/F)
I have a sheet where D:D range contains "Boys" and "Girls", now I have to manualy replace Boys=M and Girls as "F". Is there any way we can write some code, so whenever any Boys/Girls found in range D:D,, it will automatically change to M/F.

View Replies!   View Related
Find Numeric Codes In A Column And Replace In Vba
I am using the following vba code to find numeric codes in a column and replace them with the same code along with descriptive text:

Selection.Replace What:="11", Replacement:="11 - GSA"
Selection.Replace What:="10", Replacement:="10 - NYS OGS"
Selection.Replace What:="1", Replacement:=" 1 - Dist Sale"
Selection.Replace What:="2", Replacement:=" 2 - Direct Sale"
Selection.Replace What:="3", Replacement:=" 3 - No Sale: Warranty Exchange"
The problem as you might already see is that when the replacement of "1" happens, Excel will replace the 1 in the 10 and 11. Of course I want to only replace the number 1. Is there a better way to code this operation?

View Replies!   View Related
Update One Tab With Find & Replace VBA Code
My find and replace code is going to all the tabs in my workbook, but I want it to stop in my current spreadsheet I am on. Here is my

View Replies!   View Related
Catching Errors When Using The Find / Replace Function / Replace All
Need assistance with the code for catching errors when using the find / replace function in excel? In particular, I am trying to write code to break to an error message when the value or string searched for isn't found in the find / replace. At the minute I have just copied the standard code using a macro and all this does is return a message box saying X entries replaced.

View Replies!   View Related
Find, Replace With And Then Replace Adjacent Cell
I am trying to create a macro where it finds a a certain word in a column for example C. What i want it to do is find anything that says FWD_EUR and then replace that cell (e.g C2) with CASH_EUR_FWD and after it has done that it replaces the adjacent cell (e.g. D2) with EUR_FWD. I then want this to do the same with FWD_USD to CASH_USD_FWD and adjacent cell to USD_FWD.

View Replies!   View Related
Find Replace :: Find All Occurences Of And Or AND And Replace With And
Range B3:B1000 is text strings. Column C2:C50 is a list of words that I would like to "Find" in Column B and replace with it's lowercase values unless they start off the string.


Find all occurences of And or AND and replace with and
Find all occurences of With or WITH and replace with with.
Find all occurences of Or or OR and replace with or

View Replies!   View Related
Find And Replace ....
I was wondering if it is possible to do this unique find and replace that is explained below.

I have many columns with data from our database. I have one column that has my html layout in it. I want to find within the html text data and replace it with data from another column for that row.

Example: We have [[manufacturer]] in the html area that we want to replace with data from our column called Manufacturer. So, it will replace the text in the html named [[Manufacturer]] with that rows Manufacturer data we have.

Is that possible to do?

View Replies!   View Related
Find And Replace ..?
I have a list of sales associates that are assigned numbers. For example, John Doe is 1022. The data I have to work with only shows his number 1022 but for my reports management wants the name John Doe. I have about 60 sales associates and have a VB code that 'finds and replaces'. The code is huge. It has slowly grown out of hand, with more sales associates added daily. I also have 22 sheets in one workbook with specific columns to search for the numbers to replace with the names.

This is what I would like to do. Have a sheet named associates, as more associates are added I would just have to add their name and number. Have two columns with headers column A - Associates column B Associate #. Name ranges for the two columns and write a code that says look in the sheet associate, at named range 'numbertoname' and if the current sheet 'total sales' I am in has the number 1022 in column C replace it with the name John Doe. It seems like it should be easy but.......I have tried and tried today.

View Replies!   View Related
Find And Replace ‘*’
I am facing a strange problem with Find and Replace function of Excel. I converted a PDF document into a Word document. I copied the tables in the Word document to an Excel document. As the data had many ‘*’ characters, which I did not want, I used Find and Replace function to get rid of them. However, to my surprise, two things were happening.

1.When I tried to replace ‘*’ in a cell with ‘ Construction revenue ********************** ’, it was deleting all the contents of the cell.
2.When I tried to find all the cells with ‘*’ , it was selecting cells even without ‘*’

I tried various things like changing the format, pasting only values..etc, but nothing worked. Finally I had to use the Replace function of VBA to do the task. For further analysis I am attaching my Excel file with that data.

View Replies!   View Related
Find / Replace Two Different Chars
Assume someone typed the hereunder date ad TEXT.

The Formula bar shows: ="01/01/2009"
The cell presents: 01/01/2009

I need to remove the equation sign as well the two inverted-commas.

I am familiar with the "Text to Column" feature, the use of SUBSTITUTE Function, a short macro and also the Find&Replace is also a good idea but, as far as I understand,
it must be run Twice(!)

I am looking for a way to use Find&Replace in "One! shot" - meaning, to put the TWO different(!) characters [ the '=' and the " ] in the 'find what' window,
leaving the 'replace with' window empty.

I know that something similar to that can be done in a "Word" document - but can it be accomplished in Excel?

View Replies!   View Related
Find And Replace With A New Line
I want to do a Find and replace a certain character by inserting a line break. I seem to remember that this was possible on older versions of Excel but can't find it now. Anyone know what I need to put in the replace field?

View Replies!   View Related
Macro To Find And Replace
I had written a macro about two years ago that replaced longer company names with common abbreviations. I store it in Personal.xls, and it has been relatively fast (2-5 sec for most projects with < 2000 rows). However, I tried it on a file with 15,000 rows, and it choked Excel - i.e. it wouldn't run and had to be force quite (Excel XP on Windows 2000).

Here is a portion of the macro (I have about 40 companies that need to be abbreviated, names here have been simplified to protect the guilty ). I stepped through a couple of these lines to see what would happen, and each line took at least 1-2 min.

Sub ChgCompNames()
Application.ScreenUpdating = False
Cells.Replace What:="Company AAAA", Replacement:="AAAA", LookAt:=xlPart, SearchOrder:=xlByRows
Cells.Replace What:="Company BBBB", Replacement:="BBBB", LookAt:=xlPart, SearchOrder:=xlByRows
Cells.Replace What:="Company CCCC", Replacement:="CCCC", LookAt:=xlPart, SearchOrder:=xlByRows
Cells.Replace What:="Company DDDD", Replacement:="DDDD", LookAt:=xlPart, SearchOrder:=xlByRows
Application.ScreenUpdating = True
End Sub

View Replies!   View Related
Macro For Find And Replace
There are 1000's of XML tag with values.. i want a macro which should replace all the tags(the value which is in between angel brackets should only be removed and angel bracekst also should be removed) with or without space and tag value should remain unchanged.

View Replies!   View Related
Formula Find And Replace
I have text in column 1 and need a formula that will replace it with text in column 2, as shown in (fig 2).

FIG 112X Jan 2009 7.5000 put X Jan 2010 5.0000 callAA Jan 2010 17.5000 call AA Jan 2009 9.0000 putIBM Jan 2010 130.0000 call IBM Jan 2009 17.5000 put PLCE Jan 2009 30.0000 call PLCE Feb 2010 7.5000 put

FIG 212X Jan 2009 7.5000 put X Jan 09 7.50 putX Jan 2010 5.0000 callX Jan 10 5 callAA Jan 2010 17.5000 call AA Jan 10 17.50 call AA Jan 2009 9.0000 putAA Jan 09 9 putIBM Jan 2010 130.0000 call IBM Jan 10 130 call IBM Jan 2009 17.5000 put IBM Jan 09 17.50 putPLCE Jan 2009 30.0000 call PLCE Jan 09 30 call PLCE Feb 2010 7.5000 putPLCE Feb 10 7.50 put

View Replies!   View Related
Find And Replace With Lists
I am trying to do a find and replace on two list of names which are in different formats to get the list in a correct format for processing in our system.

Sheet1 - Column A - (Has Duplicates)
Tom Jones
Homer Simpson

Sheet2 - Column A - (unique values only)

I want a macro/method of looking at Sheet1 Col A - finding the EXCAT name in Sheet2 ColA and then either Replacing Sheet1 Col A with the Text in Sheet2 ColA or putting it in Sheet 1 ColB next to the one i need to replace.

Desired Example

Sheet1ColA || Sheet2ColA || Sheet1ColB Or Sheet1ColA
-------------- || ------------- || -----------------------
Tom Jones || JONES TOM I1234 || JONES TOM I1234

I have Approx 4187 names to check like this and change to the same format as is in Sheet2 Col A

So a looping macros that looks at sheet1 col A and then finds the name in Sheet2 Col A i think is required, if it does not find a matching name it should leave it BLANK and then move on to the next one to find and replace.

I have tried to split up the cells in Sheet1 ColA into FName, Lname..then doing Vlookups, but thats not working for me

View Replies!   View Related
Multiple Find And Replace
I need to recode 30+ files the have the old account numbers and I need to replace them with new codes ie

Old New
123456 10_1240
256789 12_1130
789123 15_1122

I have an excel spreadsheet which contains some 800 accounts in the format above showing old account number in column A and the new account number in column B. How would I write the VBA code to search all files in a specified folder search all rows in column E and find/replace using my spreadsheet containing the mapping details as above?
or in the very least just be able to run a macro to replace all the old codes in an individual spreadsheet.

View Replies!   View Related
Find Replace And Turn To Value
I import alot of data from a banking site and for some reason I get a column of data which should be values but is text. It also has a large number of different currency symbols etc preceeding them.


always text

Can anyone think of a way a macro could be run down the column and strip out the symbols and prefixes and leave the remain numbers as a Value not Text.

View Replies!   View Related
Bulk Find And Replace
I am attaching a sample excel workbook for reference. I have a set of coded data in numbers in ColumnA, and want to replace them with actual names which are in Column G.

As explained before, I set up columns such that all template number codes are in Column F and names in Column G. The actual raw data in Column A.

However the macro is giving me wrong replacements i.e. if the coded number was 21, its replacement is name2name1 not name 21, I hope you understand what I am saying.

It will save me bucket loads of time as I have a multiple similar columns. I am a novice in macros so I am not sure how to find full numbers (21) and replace with the specific name.

Sub FindReplace()
    Dim Frange As Range
    Dim Fr As Range
    Set Frange = Range("F1", Range("F65536").End(xlUp))
    For Each Fr In Frange
        Columns("A:A").Replace What:=Fr, Replacement:=Fr.Offset(0, 1), LookAt:=xlPart, _
                               SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    Next Fr

End Sub 

View Replies!   View Related
Find/replace And Wildcards
I have about 80 cells in a row with a varient of this in it:


The strings on the LookupData sheet change to look for different things, but

I want to modify to this:


I can locate all the cells in question using EDIT>REPLACE,


But when I put this
in the ReplaceWith box, and try to replace, I get an error message saying the formula contains an error.

Once I figure this out, I'm filling down about 60000 rows, so I'd like to get it right the first time.

View Replies!   View Related
Find And Replace In Formulas
I have various formulas (such as: =(D3-$E$3)/$E$3 )
which continues for each row (IE next row 3 is replaced with 4 etc)

I have made som errors when I made the formulas and therefore I have the following questions:

1. Is it possible to find and replace all E's with another letter (F in my case). I haven't been able to resolve this, when it has to be done inside formulas?
The optimal would be if I could set 'Display formulas' under tools, and find and replace in the formulas displayed.

2. Is there a smart way of swapping D3 with E3 for all formulas? (So the result will be: =($E$3-D3)/$E$3 and etc for all formulas)

View Replies!   View Related
Userform Find And Replace
I have attached my spreadsheet. What I am trying to do is to be able to search for data on the Data worksheet (to get to the user form I click the modify referral on the out worksheet). The code I have so far works but when I search for records that have duplicate "cmm" values it only fills in the first 10 fields on the form with the appropriate info. For example in the attached file if you click on the CMM text box and type in 6262 then find it comes up with 2 instances of 6262. but when you click on each individual record in the list box only the 1st 10 textboxes change with the appropriate info.

View Replies!   View Related
Find And Replace Using A Relative Value
I am trying to correct a problem in a database where some of the formulas contain an error. It's a simple enough fix -

View Replies!   View Related
Find And Replace On Every Worksheet
I need to do a find and replace on cell E13 on every worksheet in the workbook - a several hundred pages. The sheets are individually named not Sheet1, Sheet2......

First of all I need to find say "oldchippy" (without quotes) in cell E13 and if its there replace it with "oldchippy2", if its not there leave the contents as it is.

View Replies!   View Related
Find/Replace (Selection Only)
I am trying to remove the multiply by 100 part of the following formulas, but when I enter: *100. in the find box and leave the replace box blank, it removes the entire formula except for one closing bracket.


When I do the Find/Replace as above, it leaves me with:


View Replies!   View Related
Repeated Find And Replace
I have a sheet "Pattern" with a series of statements in column A, starting at row 12. These contain a lot of common words like 'a', 'and', 'that' etc which I would like to automatically remove. On a separate sheet 'Library' in column D I have a list of these common words which I would like to look through one by one and remove from the statements on the 'Pattern' sheet.

The code I have at the moment looks like,

Sub CommonWords()

For i = 3 To 65536
Dim w3 As String
w3 = Sheets("Library").Cells(i, 4).Value
Selection.Replace What:=w3, Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
Next i

End Sub

But this only achieves to remove the contents of the 'Pattern' sheet, column A..?? Where am I going wrong? Also, with this method if I find and replace 'a' with the 'LookAt:=xlPart' option, is this going to remove all 'a' 's, even if they are in the middle of a word?

View Replies!   View Related
Find And Replace Certain Characters
I have some records that include greek addresses. The greek alphabet contains letters that are common to the english one (A,B,E,Z,H,I,K,M,N,O,P,T,Y,X) and records with mixed characters will cause me problem. What can I do to find and replace any of those letters with the greek version of the letter.


for a record:

T.È.5123 (this is the Greek abbreviation for P.O.BOX 5123)

I'm looking for a function to replace the first letter T (wether is Greek or English) with the Greek version of it

example 2:

KYMHÓ 6 (kimis is the street, 6 the number)

I should replace English (first four ) letters with the Greek version...

example 3:

BAËÁÙPITOY 14 (valaoritou is the street, 14 the number) ...........

View Replies!   View Related
Find/Replace Values With X
I've got a piece of code I'm stuck on. Basically, I have a range of data and most cells are empty. However, I want to replace all the nonblank cells with an X. I can't quite figure out how to have the code replace something non-specific...

View Replies!   View Related
Look, Find, And If True, Replace?
I have two groups of numbers. The first group is x amount of rows and each row has 6 numbers. The second group is x amount of rows and each row is 7 numbers.

Each number from the first group needs to check to see if it exists in the second group. If it does exist, the cell should change to a highlighted cell, or switch to an 'X' or something else that identifies it has been matched. Note: Numbers may be duplicated in both groups. Is there an easy way to do this, or will it involve programming? I'm attaching an example of the "group" setup.

View Replies!   View Related
Find And Replace Letters
i have colums of data containing random figures containing letters and numbers.
I want to completely remove the letters from the colums, leaving me with just a numerical figure. Is there a way to do this? There is no set pattern to work with as there could be 1 cell with 2 numbers and 6 letters, and the next cell may have 6 numbers and 1 letter.


I want this to simply be

View Replies!   View Related
Find And Replace With Loop
I have a sheet with data on it. In column 5 I have adate range and I would like to delete and values which have "01/01/1900". Currently I have created a loop but for some reason it does nothing. I can use the find option and it picks up the cells with the ones on. For some reason it seems that it cant find them cells.

The code is as follows

Sub jdate()

rowcn = 8

target_sheet = "Status Report"
'status_flag = 0

If Sheets(target_sheet).Cells(rowcn, 5) = "01/01/1900" Then
Sheets(target_sheet).Cells(rowcn, 5) = ""
End If
rowcn = rowcn + 1
Loop While Sheets(target_sheet).Cells(rowcn, 1) > 0
End Sub

View Replies!   View Related
Find And Replace Not Working ...
I'm using Excel 2007 and trying to replace about 2000 commas with full stops. I want to use find and replace but keep getting a message saying that Excel cannot find the data I'm searching for.

Excel help suggests I haven't clicked on "find" before clicking "replace" but I did.
I've tried highlighting the column in which I want to make the replacements, but same message.

Also tried highlighting nothing, same message.

Tried copying and pasting the whole thing into a new file, but same message.

View Replies!   View Related
Dynamic Find And Replace
Is there a way in which you can use two cells (a2 & b2 for example) with a button to trigger a macro which will search for a2 and replace with b2 over a certain range of cells? unless there is a function to do it of course, which i would prefer!!

View Replies!   View Related
Find And Replace From An Array ?
I have a list of codes which I want to swap into more meaningful names. For instance, say


I want to do a find replace to turn these into


Is it possible to have these written into a single piece of code ? Or, do I need to have separate pieces of code for each Find/Replace ?

View Replies!   View Related
Find Replace Within Hyperlinks
Replace Multiple Hyperlink Addresses

This code works for me, however I do not want it to continue to the next worksheet. I want to replace the text 1 worksheet at a time, although I am not the greatest at writing these.

Sub ReplacePartHyperlinkAddress()
Dim hLink As Hyperlink
Dim wSheet As Worksheet

For Each wSheet In Worksheets
For Each hLink In wSheet.Hyperlinks
hLink.Address = Replace(hLink.Address, "http://localhost/microsoft user", "")
Next hLink
Next wSheet
End Sub

View Replies!   View Related
Find Code Only - Not Replace
Have a cmd button and text box. I need to enter a word in the text box, hit the button, and have excel show me where that text is at on the worksheets (numerous sheets). I have tried unsuccessfully suggestions, but all want to replace the text with something. I do not need to replace the text, just find it.

View Replies!   View Related
Find And Replace Using Wildcards
I know that I can use Ctl H to Find and replace say all APTs by typing APT*.
Here's a small sample of my data. How do I get rid of the letters at the end of the street numbers so that I can sort properly?


View Replies!   View Related
Find Replace Across All Worksheets
I need to replace the word "Cheese" hwen it occurs by itself throughout a wb with 20 sheets.

So if "Cheese" encountered in a cell : Replace
If "Cheese PIzza" encountered : Ignore

View Replies!   View Related
Find And Replace Next Highest
is there a way to write a macro that will do a find and replace and increase the find value by 8 and increase the replace value by 2 each time?

View Replies!   View Related
Copyright © 2005-08, All rights reserved