Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Get External Data 3

Status
Not open for further replies.

MJamison07

Technical User
Dec 13, 2001
54
US
I have a spreadsheet that gets data from an ODBC source. If a date field is blank in the source, it appears as 1/0/1900 in the excel sheet. Is there any way for me to make it appear as a blank cell in the excel sheet instead of 1/0/1900?

Also, when I refresh the data it changes the column width. Is there a way I can keep the column width fixed when I refresh?

Thank you,

Martha
 
You could eliminate the date issue with an if(iserror( formula.

As for your column width issue, you could write a small macro to adjust the column width on a refresh. If you dont know VBA, then you can simply record the macro.
 
Where would I put the iserror formula? excel or source?
 

In Excel. Check out this FAQ...

Why are Dates and Times so much trouble? faq68-5827


Skip,

[glasses] [red]Be advised:[/red]When Viscounts were guillotined just as they were disclosing where their jewels were hidden, it shows to go that you should...
Never hatchet your Counts before they chicken! [tongue]
 
If you are setting up connection to your data via Data menu - Import External data - Import data you should check out the Properties of the connection, under Data formatting and layout there is the 'Adjust column widths' option. My ref Excel 2002.

regards Hugh,
 


Hugh,

This is NOT Import data, it a QUERY.

Skip,

[glasses] [red]Be advised:[/red]When Viscounts were guillotined just as they were disclosing where their jewels were hidden, it shows to go that you should...
Never hatchet your Counts before they chicken! [tongue]
 
Skip,

Sorry I thought it may have been of the

Workbooks("MyBook").QueryTables.Add(Connection:blah...

variety. You can then do

.AdjustColumnWidth = False

to the QueryTable

regards Hugh
 


It's not column width, it's an empty value in a date field. ZERO date is 1/0/1900.

Why are Dates and Times so much trouble? faq68-5827

Skip,

[glasses] [red]Be advised:[/red]When Viscounts were guillotined just as they were disclosing where their jewels were hidden, it shows to go that you should...
Never hatchet your Counts before they chicken! [tongue]
 
Thanks for your help. Since I can't make it go away, I just used the excel date info you gave me and developed a fix. Using conditional formatting I made the font in the cells that contain the 0 date info white. It's still there but it doesn't show when I print (on white paper anyway).

Thanks.
Martha
 


The trick is understanding the data and what your options are.

GOOD SOLUTION! ;-)

Skip,

[glasses] [red]Be advised:[/red]When Viscounts were guillotined just as they were disclosing where their jewels were hidden, it shows to go that you should...
Never hatchet your Counts before they chicken! [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top