View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Auric__ Auric__ is offline
external usenet poster
 
Posts: 538
Default Issue with blanks and spaces

L. Howard wrote:

I am running code that produces a huge list (short phrases) in column A2
and down.

In the normal operation of the code, there are times when it produces
the phrases as wanted and other times due to the data the code is
working on, it produces the phrases and apparently blank cells.

However, the cells actually have 5 spaces in them. When I look the
sheet over it is evident why there are 5 spaces. To fix the problem by
altering the main code would for sure require a massive rewrite, if I
could even explain what is causing the spaces.

I am fairly certain manipulating the data in column A is the better way
to cope with the "blank looking" cells that have the spaces.

Where I am stumped is the cells with the short phrases have spaces that
are needed. So a blanket remove spaces from column A would not work.

I cannot figure how to distinguish the good spaces from the bad spaces
then remove the cells with the bad spaces.

The end result being a list of the phrases in A2 and down with no
blanks.

I looked for examples of filter code and for If IsText but did not come
up with anything.

Also, I cannot be sure it will always be 5 spaces each time.


At the spot where you put the text ino the cell, try something like this:

If Len(Trim$(random_phrase)) 0 Then ActiveCell.Value = random_phrase

--
Thanks for the feedback, dream-killer.