Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Alex
 
Posts: n/a
Default Format of cells problem...

Hello

I built a macro that will go through a list of data and higlight in bold
type cells that are of a certain value. The values are text e.g. Smith,
Jones, etc.

I get new values each month from an external source in a .xls file. If I
right click those new values they are formatted as general with alignment
general and bottom.

That format is exactly the same as the ones in the excel sheet that I paste
the new values to. However, when I run my macro it fails to highlight cells.

For example, suppose for May-05 I have 'Smith' in cell A1 and for Jun-05 I
have 'Smith' in cell A2. When I ask the macro to highlight all values called
'Smith' it only highlights A1 and not A2.

When i check the fomat of the cells they are exactly the same. Why is this
happening?

Possible clue: when I cut and paste the from cell A1 to A2 the 'Smith' in
cell A2 shifts position slightly as if it weren't formatted exactly the same
as A1. However, I cannot find out why that disparity is occuring.

Any thoughts would be useful...

Thanks

Alex
  #2   Report Post  
Nuraq
 
Posts: n/a
Default

My guess is that there are spaces in the second string. In Excel, "Smith"
is different to "Smith ". Use the Trim function to get rid of spaces...
you can use it in your Macro.

"Alex" wrote in message
...
Hello

I built a macro that will go through a list of data and higlight in bold
type cells that are of a certain value. The values are text e.g. Smith,
Jones, etc.

I get new values each month from an external source in a .xls file. If I
right click those new values they are formatted as general with alignment
general and bottom.

That format is exactly the same as the ones in the excel sheet that I
paste
the new values to. However, when I run my macro it fails to highlight
cells.

For example, suppose for May-05 I have 'Smith' in cell A1 and for Jun-05 I
have 'Smith' in cell A2. When I ask the macro to highlight all values
called
'Smith' it only highlights A1 and not A2.

When i check the fomat of the cells they are exactly the same. Why is this
happening?

Possible clue: when I cut and paste the from cell A1 to A2 the 'Smith' in
cell A2 shifts position slightly as if it weren't formatted exactly the
same
as A1. However, I cannot find out why that disparity is occuring.

Any thoughts would be useful...

Thanks

Alex



  #3   Report Post  
bj
 
Posts: n/a
Default

Since it doesn't line up the same, there is a good chance that there are
spaces before or after the "Smith"
On one of Smiths which did not format (Say A3)
in a empty cell enter
=A3=trim(A3) itf the answer is false ithere are probably spaces.

"Alex" wrote:

Hello

I built a macro that will go through a list of data and higlight in bold
type cells that are of a certain value. The values are text e.g. Smith,
Jones, etc.

I get new values each month from an external source in a .xls file. If I
right click those new values they are formatted as general with alignment
general and bottom.

That format is exactly the same as the ones in the excel sheet that I paste
the new values to. However, when I run my macro it fails to highlight cells.

For example, suppose for May-05 I have 'Smith' in cell A1 and for Jun-05 I
have 'Smith' in cell A2. When I ask the macro to highlight all values called
'Smith' it only highlights A1 and not A2.

When i check the fomat of the cells they are exactly the same. Why is this
happening?

Possible clue: when I cut and paste the from cell A1 to A2 the 'Smith' in
cell A2 shifts position slightly as if it weren't formatted exactly the same
as A1. However, I cannot find out why that disparity is occuring.

Any thoughts would be useful...

Thanks

Alex

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
How to link cells and keep number format altogether Yi Excel Discussion (Misc queries) 0 May 6th 05 02:12 PM
how 2 Count number of cells that have specific condition format? daveydavey Excel Worksheet Functions 2 May 4th 05 02:06 PM
Problem with wrap text format Mitch Excel Worksheet Functions 1 January 20th 05 09:46 AM
Problem with txt format Nuno Excel Discussion (Misc queries) 1 January 18th 05 04:11 PM
I am not able to format cells for zip codes JMelloman Excel Worksheet Functions 3 December 14th 04 02:24 AM


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