LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Tell what format each cell is in

When using Excel for mail merging at work, when we get an address like
"3-5 East Street" and "3-5" is in a cell on its own, separate from
East Street, Excel will change the "3-5" to 3-May (U.K. date format).
This is because it is trying (unsuccessfully) to ascertain the format
of the data in the cell.

We can get round this by changing the cell format to "Text", but then
it will change to something like "39936", Excel's way of storing
dates. Either way, it doesn't do what we want!

Usually, if we notice a cell that has changed to "3 May", it is easy
to figure out what it should have been, and change it manually. This
is not practical on a spreadsheet of 20,000 addresses!

I thought a VBA solution might be possible, if the macro could go
through each cell in the ActiveRange, seeing if it is formatted as
"Date". If it is, the macro could halt with the ActiveCell as that
cell. Then we could locate and change these problem cells quickly.

It seems the property I need is "ActiveCell.NumberFormat", but I am
having trouble getting this to work in a macro. Plus,
ActiveCell.NumberFormat does not return something like "Date", it
returns the date format of that cell. I am also having trouble
getting the macro to stop dead when it discovers a date, and making
the problem cell the ActiveCell, so I can see where it is.

Does anyone have any suggestions as to how I might overcome this
problem? Is VBA the right way to solve it?

Steve
 
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
Lock Cell Format - Allow copy and paste of data without format change Chris12InKC Excel Worksheet Functions 2 May 9th 23 07:42 PM
cell format - remove cell format pattern without effecting colors Bas Excel Discussion (Misc queries) 1 March 23rd 09 02:54 PM
Can cell format come from and change with reference cell format jclouse Excel Discussion (Misc queries) 1 November 29th 06 03:20 AM
Excel Auto-Format cell to email format Please Help Me Excel Discussion (Misc queries) 1 March 23rd 06 05:15 PM
How do I copy data in single cell format to a merged cell format Paul Excel Discussion (Misc queries) 1 June 27th 05 11:00 AM


All times are GMT +1. The time now is 01:10 AM.

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"