Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JJ JJ is offline
external usenet poster
 
Posts: 122
Default Clean funtion

Is there a way I can apply the clean function to my whole spreadsheet?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Clean funtion

I can't remember it there is a vba equivalent so try this

sub cleanitup()
for each cel in selection
cel.value=application.clean(cel)
next
end sub

--
Don Guillett
SalesAid Software

"JJ" wrote in message
...
Is there a way I can apply the clean function to my whole spreadsheet?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clean funtion


If you would like to clean an entire sheet of its contents (withou
removing formatting) use the ClearContents method, otherwise use th
delete method. Here is an example:

Sub ClearActiveSheet ()
Application.ScreenUpdating=False ' lets code execute faster

ActiveSheet.Cells.Select
Selection.ClearContents

Application.ScreenUpdating=True
End Su

--
crispb
-----------------------------------------------------------------------
crispbd's Profile: http://www.excelforum.com/member.php...fo&userid=1088
View this thread: http://www.excelforum.com/showthread.php?threadid=27454

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Clean funtion

are you sure you want to use CLEAN.

The use of the CLEAN Worksheet Function to remove unprintable characters
will only remove CHAR(0) through CHAR(31), Char(129), Char(141), Char(143),
and Char(144). It will have no effect on Char(160).

When you apply the function to all cells in a workbook you would wipe out
formulas; remove linebreaks closing up words that won't even have a space
between them.

Suggest reading the paragraphs before and within the TRIMALL macro
description on my page.
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"JJ" wrote ...
Is there a way I can apply the clean function to my whole spreadsheet?





  #6   Report Post  
Posted to microsoft.public.excel.programming
JJ JJ is offline
external usenet poster
 
Posts: 122
Default Clean funtion

I want to remove ANY characters there are not alphanumeric (not to include
spaces or hyphens, I still need those). These cells will not have formulas
at the time I'm cleaning up the cells. Since I pull from different
databases, I run into a problem when I compare the cell values - which I need
to do from the right. If there is a character that takes a space they won't
match and because this character is not appearing in every cell or even in
every column I can't just say ignore the first right character.

Does that make sense?

"David McRitchie" wrote:

are you sure you want to use CLEAN.

The use of the CLEAN Worksheet Function to remove unprintable characters
will only remove CHAR(0) through CHAR(31), Char(129), Char(141), Char(143),
and Char(144). It will have no effect on Char(160).

When you apply the function to all cells in a workbook you would wipe out
formulas; remove linebreaks closing up words that won't even have a space
between them.

Suggest reading the paragraphs before and within the TRIMALL macro
description on my page.
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"JJ" wrote ...
Is there a way I can apply the clean function to my whole spreadsheet?




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Clean funtion

Sub CleanCells()
Dim sStr as String
Dim cell as Range
for each cell in selection
if not cell.hasFormla then
sStr = Application.Substitute(cell.value,chr(160)," ")
sStr = Application.Clean(sStr)
sStr = Application.Trim(sStr)
cell.Value = sStr
end if
Next
End Sub

--
Regards,
Tom Ogilvy

"JJ" wrote in message
...
I want to remove ANY characters there are not alphanumeric (not to include
spaces or hyphens, I still need those). These cells will not have

formulas
at the time I'm cleaning up the cells. Since I pull from different
databases, I run into a problem when I compare the cell values - which I

need
to do from the right. If there is a character that takes a space they

won't
match and because this character is not appearing in every cell or even in
every column I can't just say ignore the first right character.

Does that make sense?

"David McRitchie" wrote:

are you sure you want to use CLEAN.

The use of the CLEAN Worksheet Function to remove unprintable characters
will only remove CHAR(0) through CHAR(31), Char(129), Char(141),

Char(143),
and Char(144). It will have no effect on Char(160).

When you apply the function to all cells in a workbook you would wipe

out
formulas; remove linebreaks closing up words that won't even have a

space
between them.

Suggest reading the paragraphs before and within the TRIMALL macro
description on my page.
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"JJ" wrote ...
Is there a way I can apply the clean function to my whole spreadsheet?






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
clean up code a little terilad Excel Discussion (Misc queries) 12 April 12th 10 07:35 PM
Clean matrix from 0 Arne Hegefors Excel Worksheet Functions 2 February 15th 07 06:14 PM
clean up data BNT1 via OfficeKB.com Excel Discussion (Misc queries) 1 February 14th 07 03:43 PM
=clean(a1) news.verizon.net Excel Programming 2 August 25th 03 11:08 PM
How do I Clean up this formula? Billy Two Hats Excel Programming 1 July 14th 03 07:07 AM


All times are GMT +1. The time now is 12:11 PM.

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"