Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default find & replace (hidden) '

hi

how can i write code to search a worksheet & replace all hidden ' with
nothing when the cell is (otherwise) empty

Cheers
JulieD


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default find & replace (hidden) '

JulieD,

Using "Trim" on each cell in the range will remove '.
However, Trim wipes out formulas and balks at cell errors.
So set up a range using "Special Cells" to select constants and text values or
check each cell as you come to it...
'-----------------------------------
Sub GetThemCritters()
Dim objCell As Range
For Each objCell In ActiveSheet.UsedRange 'or Selection
If Not IsError(objCell) And Not objCell.HasFormula Then _
objCell.Value = Trim$(objCell.Value)
Next 'objCell
End Sub
'-------------------------------------

Regards,
Jim Cone
San Francisco, CA
'----------------------------------------
"JulieD" wrote in message ...
hi
how can i write code to search a worksheet & replace all hidden ' with
nothing when the cell is (otherwise) empty
Cheers
JulieD


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default find & replace (hidden) '

Hi Jim

thanks so much ... this has saved me HOURS of work ...

is it possible to easily exclude a range - the used range of the workbook is
A1:J464 (maybe more / less rows in the future) and i need to it for
everything EXCEPT column B

cheers
JulieD


"Jim Cone" wrote in message
...
JulieD,

Using "Trim" on each cell in the range will remove '.
However, Trim wipes out formulas and balks at cell errors.
So set up a range using "Special Cells" to select constants and text

values or
check each cell as you come to it...
'-----------------------------------
Sub GetThemCritters()
Dim objCell As Range
For Each objCell In ActiveSheet.UsedRange 'or Selection
If Not IsError(objCell) And Not objCell.HasFormula Then _
objCell.Value = Trim$(objCell.Value)
Next 'objCell
End Sub
'-------------------------------------

Regards,
Jim Cone
San Francisco, CA
'----------------------------------------
"JulieD" wrote in message

...
hi
how can i write code to search a worksheet & replace all hidden ' with
nothing when the cell is (otherwise) empty
Cheers
JulieD




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default find & replace (hidden) '

Julie,

I assume you have leading or trailing spaces in Column B that
you want to retain so...
Select the range to trim or select multiple ranges and use this
revised code. It first goes to each area selected and
runs the Trim function and then moves to the next selected
area and does the same.

'------------------------
Sub GetThemCrittersII()
Dim objCell As Range
Dim objArea As Range

For Each objArea In Selection.Areas
For Each objCell In objArea
If Not IsError(objCell) And Not objCell.HasFormula Then _
objCell.Value = Trim$(objCell.Value)
Next 'objCell
Next 'objArea

Set objCell = Nothing
Set objArea = Nothing
End Sub
'-------------------------------
Regards,
Jim Cone
San Francisco, CA

"JulieD" wrote in message ...
Hi Jim
thanks so much ... this has saved me HOURS of work ...
is it possible to easily exclude a range - the used range of the workbook is
A1:J464 (maybe more / less rows in the future) and i need to it for
everything EXCEPT column B
cheers
JulieD


- snip-
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default find & replace (hidden) '

JulieD,

I just discovered that Ragdyer posted an answer to you in the Misc group
His answer is easier to implement.
Multiple posts can aggravate people...

Regards,
Jim Cone
San Francisco, CA

"Jim Cone" wrote in message ...
Julie,

I assume you have leading or trailing spaces in Column B that
you want to retain so...
Select the range to trim or select multiple ranges and use this
revised code. It first goes to each area selected and
runs the Trim function and then moves to the next selected
area and does the same.

'------------------------
Sub GetThemCrittersII()
Dim objCell As Range
Dim objArea As Range

For Each objArea In Selection.Areas
For Each objCell In objArea
If Not IsError(objCell) And Not objCell.HasFormula Then _
objCell.Value = Trim$(objCell.Value)
Next 'objCell
Next 'objArea

Set objCell = Nothing
Set objArea = Nothing
End Sub
'-------------------------------
Regards,
Jim Cone
San Francisco, CA

"JulieD" wrote in message ...
Hi Jim
thanks so much ... this has saved me HOURS of work ...
is it possible to easily exclude a range - the used range of the workbook is
A1:J464 (maybe more / less rows in the future) and i need to it for
everything EXCEPT column B
cheers
JulieD


- snip-



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default find & replace (hidden) '

Hi Jim

sorry it wasn't meant to be a multiple post - i posted it there and then
realised that i needed a code rather than a once off solution as this data
is going to be a regular import - so your solution is the one i need to
implement.

Regards
julieD

"Jim Cone" wrote in message
...
JulieD,

I just discovered that Ragdyer posted an answer to you in the Misc group
His answer is easier to implement.
Multiple posts can aggravate people...

Regards,
Jim Cone
San Francisco, CA

"Jim Cone" wrote in message

...
Julie,

I assume you have leading or trailing spaces in Column B that
you want to retain so...
Select the range to trim or select multiple ranges and use this
revised code. It first goes to each area selected and
runs the Trim function and then moves to the next selected
area and does the same.

'------------------------
Sub GetThemCrittersII()
Dim objCell As Range
Dim objArea As Range

For Each objArea In Selection.Areas
For Each objCell In objArea
If Not IsError(objCell) And Not objCell.HasFormula Then _
objCell.Value = Trim$(objCell.Value)
Next 'objCell
Next 'objArea

Set objCell = Nothing
Set objArea = Nothing
End Sub
'-------------------------------
Regards,
Jim Cone
San Francisco, CA

"JulieD" wrote in message

...
Hi Jim
thanks so much ... this has saved me HOURS of work ...
is it possible to easily exclude a range - the used range of the

workbook is
A1:J464 (maybe more / less rows in the future) and i need to it for
everything EXCEPT column B
cheers
JulieD


- snip-



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
Find & Replace: find part cell, replace whole cell katy Excel Worksheet Functions 3 April 3rd 23 01:20 PM
Find and Replace - Replace with Blank Space Studebaker Excel Discussion (Misc queries) 4 April 3rd 23 10:55 AM
Find and replace results can the appearance of find be different? LLS at DPW Excel Discussion (Misc queries) 2 October 26th 09 11:16 PM
where to put results of find operation in find and replace functio DEP Excel Worksheet Functions 5 November 15th 06 07:52 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM


All times are GMT +1. The time now is 03:53 PM.

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

About Us

"It's about Microsoft Excel"