Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using VB to format Excel cells

I have a co-worker who is extracting data from SQL Server,
and using VB to create a spreadsheet. Everything is
working fine, except for the fact that he can't seem to
get the CURRENCY values to format within the spreadsheet.
He can get them to appear as numbers, with decimals but
not in CURRENCY format. Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Using VB to format Excel cells

xlApp.ActiveWorkbok.Activesheet.Range("A1").Style = "Currency"

you may have other objects that point to the book/sheet/range, so just
adjust to suit.
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Ed" wrote in message
...
I have a co-worker who is extracting data from SQL Server,
and using VB to create a spreadsheet. Everything is
working fine, except for the fact that he can't seem to
get the CURRENCY values to format within the spreadsheet.
He can get them to appear as numbers, with decimals but
not in CURRENCY format. Any ideas?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Using VB to format Excel cells

Try formatting the columns that the data appears in or
you could use a range as your selection. Here modify the
columns to your need or change the selection to a range:

Columns("D:P").Select
Selection.NumberFormat = "$#,##0"

Regards,
Alex.



-----Original Message-----
I have a co-worker who is extracting data from SQL

Server,
and using VB to create a spreadsheet. Everything is
working fine, except for the fact that he can't seem to
get the CURRENCY values to format within the

spreadsheet.
He can get them to appear as numbers, with decimals but
not in CURRENCY format. Any ideas?
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using VB to format Excel cells

Good chance that they are being stored as Text. If so, you can't currency
format text.

--
Regards,
Tom Ogilvy

Ed wrote in message
...
I have a co-worker who is extracting data from SQL Server,
and using VB to create a spreadsheet. Everything is
working fine, except for the fact that he can't seem to
get the CURRENCY values to format within the spreadsheet.
He can get them to appear as numbers, with decimals but
not in CURRENCY format. Any ideas?



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
Excel 2007 format cells to date format Stefan Excel Discussion (Misc queries) 0 June 1st 10 09:06 PM
How to format cells in Excel 2007 (i.e. currency format)? DonR Excel Discussion (Misc queries) 2 May 25th 08 11:16 PM
want format cells alignment not format cells font style Jeannie Bean Excel Discussion (Misc queries) 2 February 10th 06 09:31 AM
Cells won't convert to number format, even after format/cells/num. scottr Excel Discussion (Misc queries) 5 April 12th 05 11:02 PM
How to format cells in Excel for time in format mm:ss.00 Very Timely Excel Worksheet Functions 0 March 30th 05 07:35 AM


All times are GMT +1. The time now is 10:09 PM.

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"