Jump to content

Format Cell as Date *3/14/2001


Recommended Posts

Is there an easy way to format a cell to date or currency? I found some old threads that were not much help. 

I have looked at the wiki but I only see how to format as a number

I assume there is not a way like I did for making the text bold. 

Any suggest or help would be appreciated. 

 

 

I am able to get the format changed to text using

$oExcel.Activesheet.range("A1:L1").NumberFormat = "@"

 

#include <Excel.au3>

Global $sBox

Func InputHowMany()

    While 1
        $sBox = Number(InputBox("How many?", "How many?"))
        If $sBox = 0 Then
               $iMsg = MsgBox(1, 'Oops', 'Please enter a valid number')
            If $iMsg = 2 Then Exit
        Else
            Return $sBox - 1
        EndIf
    WEnd
 EndFunc

InputHowMany()
$oExcel = _Excel_Open()
$oExcel = _Excel_BookNew($oExcel)

Local $t = 2
Local $w = 1
Local $c = 301

$oExcel.Activesheet.range("A1:L1").font.bold = True


Do
   _Excel_RangeWrite($oExcel,Default, "Status", "A1")
   _Excel_RangeWrite($oExcel,Default, "Last Name", "B1")
   _Excel_RangeWrite($oExcel,Default, "Last Name", "C1")
   _Excel_RangeWrite($oExcel,Default, "SSN", "D1")
   _Excel_RangeWrite($oExcel,Default, "DOB", "E1")
   _Excel_RangeWrite($oExcel,Default, "Email", "F1")
   _Excel_RangeWrite($oExcel,Default, "Mailing Address", "G1")
   _Excel_RangeWrite($oExcel,Default, "City", "H1")
   _Excel_RangeWrite($oExcel,Default, "State", "I1")
   _Excel_RangeWrite($oExcel,Default, "Zip Code", "J1")
   _Excel_RangeWrite($oExcel,Default, "Gender", "K1")
   _Excel_RangeWrite($oExcel,Default, "Phone", "L1")

   _Excel_RangeWrite($oExcel,Default, '=B' & $c, "B" & $t)
   _Excel_RangeWrite($oExcel,Default, '=C' & $c, "C" & $t)
   _Excel_RangeWrite($oExcel,Default, '=D' & $c, "D" & $t)
   _Excel_RangeWrite($oExcel,Default, '=E' & $c, "E" & $t)
   _Excel_RangeWrite($oExcel,Default, '=F' & $c, "F" & $t)
   _Excel_RangeWrite($oExcel,Default, '=G' & $c, "G" & $t)
   _Excel_RangeWrite($oExcel,Default, '=H' & $c, "H" & $t)
   _Excel_RangeWrite($oExcel,Default, '=I' & $c, "I" & $t)
   _Excel_RangeWrite($oExcel,Default, '=J' & $c, "J" & $t)
   _Excel_RangeWrite($oExcel,Default, '=K' & $c, "K" & $t)
   _Excel_RangeWrite($oExcel,Default, '=L' & $c, "L" & $t)

      $c = $c + 1
      $t = $t + 1
      $w = $w + 1

Until $w > $sBox

 

 

 

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

The link I posted in the wiki for numbers contains examples for date format as well: http://peltiertech.com/Excel/NumberFormats.html

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...