Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Nurddin
 
Posts: n/a
Default macro to Find Replace in Excel

Hi,

I need to find double quotes in an excel file (could be a selectoin of
rows) and replace them with nothing ( yeah just want to delete them)

The built in Excel function to Find and Replace all gives me error
"formula too long"

Can someone please write me a small macro code

thanks
  #2   Report Post  
Arvi Laanemets
 
Posts: n/a
Default

Hi

I just tried with Find and Replace

Replace All " with nothing entered removes all " from sheet/range
Replace All "" with nothing entered removes all "" from sheet/range, but
entries like " or " " remain unchanged.


Arvi Laanemets



"Nurddin" wrote in message
m...
Hi,

I need to find double quotes in an excel file (could be a selectoin of
rows) and replace them with nothing ( yeah just want to delete them)

The built in Excel function to Find and Replace all gives me error
"formula too long"

Can someone please write me a small macro code

thanks



  #3   Report Post  
 
Posts: n/a
Default


Arvi Laanemets wrote:
Hi

I just tried with Find and Replace

Replace All " with nothing entered removes all " from sheet/range
Replace All "" with nothing entered removes all "" from sheet/range,

but
entries like " or " " remain unchanged.


Arvi Laanemets



"Nurddin" wrote in message
m...
Hi,

I need to find double quotes in an excel file (could be a selectoin

of
rows) and replace them with nothing ( yeah just want to delete

them)

The built in Excel function to Find and Replace all gives me error
"formula too long"

Can someone please write me a small macro code

thanks


  #4   Report Post  
 
Posts: n/a
Default


Arvi Laanemets wrote:
Hi

I just tried with Find and Replace

Replace All " with nothing entered removes all " from sheet/range
Replace All "" with nothing entered removes all "" from sheet/range,

but
entries like " or " " remain unchanged.


Arvi Laanemets



"Nurddin" wrote in message
m...
Hi,

I need to find double quotes in an excel file (could be a selectoin

of
rows) and replace them with nothing ( yeah just want to delete

them)

The built in Excel function to Find and Replace all gives me error
"formula too long"

Can someone please write me a small macro code

thanks


  #5   Report Post  
 
Posts: n/a
Default

the error of "formula too long" comes because the field length is very
large (2000 characters)

therefore only solution is to make a vb macro to find and replace. can
you please make me small macro.
help will be greatly appreciated.

thanks



  #6   Report Post  
Dave Peterson
 
Posts: n/a
Default

This seemed to work ok:

Option Explicit
Sub testme02()

Dim FoundCell As Range
Dim ConstCells As Range

With Worksheets("sheet1")
Set ConstCells = Nothing
On Error Resume Next
Set ConstCells = .Cells.SpecialCells(xlCellTypeConstants, _
xlTextValues)
On Error GoTo 0
If ConstCells Is Nothing Then
MsgBox "No Text Constants on this sheet!"
Exit Sub
End If

With ConstCells
'get as many as we can in one step
.Replace what:=Chr(34), replacement:=Chr(39), _
lookat:=xlPart, searchorder:=xlByRows

Do
Set FoundCell = .Cells.Find(what:=Chr(34), _
after:=.Cells(1), _
LookIn:=xlValues, _
lookat:=xlPart, _
searchorder:=xlByRows, _
searchdirection:=xlNext, _
MatchCase:=False)

If FoundCell Is Nothing Then
'done, get out!
Exit Do
End If

FoundCell.Value = Replace(FoundCell.Value, Chr(34), Chr(39))

Loop
End With
End With
End Sub

Chr(34) is a double quote: "
chr(39) is a single quote: '

If you're using xl2k or higher, you can change this logical line:
FoundCell.Value = Application.Substitute(FoundCell.Value, _
Chr(34), Chr(39))
to
FoundCell.Value = Replace(FoundCell.Value, Chr(34), Chr(39))

(Replace was added in xl2k.)

Nurddin wrote:

Hi,

I need to find double quotes in an excel file (could be a selectoin of
rows) and replace them with nothing ( yeah just want to delete them)

The built in Excel function to Find and Replace all gives me error
"formula too long"

Can someone please write me a small macro code

thanks


--

Dave Peterson
  #7   Report Post  
 
Posts: n/a
Default

wow, this thing works.
you made my life easy.

thanks a lot Dave. u are great

merci

  #8   Report Post  
 
Posts: n/a
Default


Arvi Laanemets wrote:
Hi

I just tried with Find and Replace

Replace All " with nothing entered removes all " from sheet/range
Replace All "" with nothing entered removes all "" from sheet/range,

but
entries like " or " " remain unchanged.


Arvi Laanemets



"Nurddin" wrote in message
m...
Hi,

I need to find double quotes in an excel file (could be a selectoin

of
rows) and replace them with nothing ( yeah just want to delete

them)

The built in Excel function to Find and Replace all gives me error
"formula too long"

Can someone please write me a small macro code

thanks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro in Excel 2002 to save a workbook to a FTP location Lloyd Excel Discussion (Misc queries) 0 December 21st 04 02:49 PM
Macro not working with Excel 2003 Fernando Gomez Excel Discussion (Misc queries) 1 December 16th 04 12:19 AM
How Can I find and replace symbols in excel data ( white square) alawhizkid Excel Discussion (Misc queries) 1 December 14th 04 10:44 PM
excel macro inconsistency JM Excel Discussion (Misc queries) 2 December 9th 04 01:13 AM
boolean find criteria in Excel davista00 Excel Discussion (Misc queries) 1 December 1st 04 03:45 PM


All times are GMT +1. The time now is 10:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"