Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro to remove

All,
I have a macro that copies two columns to a new workbook and a third row
adds up each cell in columns 1 and two. This script is part of a much
larger macro. The problem is that every now and then one of the cells that
is being copied over has a hidden space or character that causes the value
in column three to list #Value! instead of the correct amount. How can I
have the macro remove any hidden spaces/characters, etc so that when the
third column is adding up the two columns, I do not get the #Value! output?

Thanks

John


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro to remove

There could be a few changes that you make.

I would think that the easiest would be to just use =sum() in your formula.
=Sum() ignores text.

If there's a hidden space or character that affects the sum (maybe you have 123_
(where _ represents a character that makes that cell text)), but you still want
to include 123 in the sum, then cleaning the data would be the best way to go.

You may want to try David McRitchie's routine to clean the data:

http://www.mvps.org/dmcritchie/excel/join.htm#trimall
(look for "Sub Trimall()")

John wrote:

All,
I have a macro that copies two columns to a new workbook and a third row
adds up each cell in columns 1 and two. This script is part of a much
larger macro. The problem is that every now and then one of the cells that
is being copied over has a hidden space or character that causes the value
in column three to list #Value! instead of the correct amount. How can I
have the macro remove any hidden spaces/characters, etc so that when the
third column is adding up the two columns, I do not get the #Value! output?

Thanks

John


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro to remove

Thanks Dave,
Using the sum function did the trick. It is amazing how sometimes the simple
things are most effective.

John



"Dave Peterson" wrote in message
...
There could be a few changes that you make.

I would think that the easiest would be to just use =sum() in your
formula.
=Sum() ignores text.

If there's a hidden space or character that affects the sum (maybe you
have 123_
(where _ represents a character that makes that cell text)), but you still
want
to include 123 in the sum, then cleaning the data would be the best way to
go.

You may want to try David McRitchie's routine to clean the data:

http://www.mvps.org/dmcritchie/excel/join.htm#trimall
(look for "Sub Trimall()")

John wrote:

All,
I have a macro that copies two columns to a new workbook and a third row
adds up each cell in columns 1 and two. This script is part of a much
larger macro. The problem is that every now and then one of the cells
that
is being copied over has a hidden space or character that causes the
value
in column three to list #Value! instead of the correct amount. How can I
have the macro remove any hidden spaces/characters, etc so that when the
third column is adding up the two columns, I do not get the #Value!
output?

Thanks

John


--

Dave Peterson



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 - Remove #n/a Schwimms Excel Discussion (Misc queries) 3 February 14th 08 06:29 PM
macro 4.remove D. Excel Discussion (Misc queries) 2 September 29th 07 02:52 PM
Macro to Remove Macro Text Rob Excel Discussion (Misc queries) 1 June 21st 07 11:49 PM
Macro code to remove a macro after it executes Charles Excel Programming 4 March 22nd 06 12:11 PM
Remove Macro Hargrove[_2_] Excel Programming 3 June 9th 04 06:33 PM


All times are GMT +1. The time now is 06:03 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"