Home All Groups Group Topic Archive Search About

need help with how to format a cell in Excel with VB6

Author
8 Mar 2006 1:55 AM
~@%.com
I have a Excel spreadsheet  where a cell is formatted as general. How do you change it to date or any other
format  for that matter


Thnaks in advance for the help
--
----------------------------------------------
Posted with NewsLeecher v3.0 Final
* Binary Usenet Leeching Made Easy
* http://www.newsleecher.com/?usenet
----------------------------------------------

Author
8 Mar 2006 2:00 AM
Karl E. Peterson
Johnny wrote:
> I have a Excel spreadsheet  where a cell is formatted as general. How
> do you change it to date or any other format  for that matter

Maybe this will get you going?

      ' Format entire table.
      Set table = TopLeft.Worksheet.Range(TopLeft.Offset(1, 0),
TopLeft.Offset(j, i))
      With table
         .ClearFormats
         .NumberFormat = "0.0000"
         .HorizontalAlignment = xlRight
         .Font.Bold = False
         .Rows(1).Font.Bold = True
         .Rows(.Rows.Count).Font.Bold = True
         .Columns(1).Font.Bold = True
         .Columns(1).NumberFormat = "0"
         .Columns(.Columns.Count - 1).Font.Bold = True
      End With

That formats an entire range to a specific format.  Take a look at that
NumberFormat property in the helpfiles.
--
Working without a .NET?
http://classicvb.org/
Author
8 Mar 2006 2:24 AM
Bob Butler
"Johnny" <~@%.com> wrote in message
news:440e399c$0$6240$c3e8da3@news.astraweb.com
> I have a Excel spreadsheet  where a cell is formatted as general. How
> do you change it to date or any other format  for that matter

Karl provided info but for future reference an easy way to get started is to
open excel, start recording a macro, do what you want to do manually, stop
recording and then look at the generated code.  It's usually not the best
but it does identify the objects, properties and methods needed.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."