Á
Á÷À˵ÄË«Óã
I want to know how to use the Application.WorkSheetFunction.Text
function,especially the second argument it uses.
Any help?
--
function,especially the second argument it uses.
Any help?
--
Application.WorksheetFunction.Today() or
Application.WorksheetFunction.Date(Year,Month,Day)
Arvi Laanemets said:Hi
In VBA exists function Format(), with syntax
Format(Expression,FormatString,FirstDayOfWeek,FirstWeekOfYear)
All parameters except 1st one are optional, last 2 parameters will have
meaning only, when expression returns a date.
In Excel exists function TEXT(), with syntax
TEXT(NumericExpression,FormatString)
The worksheetfunction TEXT() is more limited in use, but in general both
behave identical in their common area, and both do return a string value.
In VBA, Application.WorksheetFunction.AnyValidFunction invokes an Excel
worksheetfunction, which otherwise you usually enter into worksheet cell
as a part of formula. P.e.:
TodaysDateString = Application.WorksheetFunction.Text(Date,"dddd,
dd.mm.yyyy")
, which really is same as
TodaysDateString = Format(Date,"dddd, dd.mm.yyyy")
Btw, in VBA exists functions Date and Now, with syntax
Date
Now
, which are returning current system date (and time).
An equivalent for those are the worksheetfunctions TODAY() or NOW(), in
VBA used p.e. as
Application.WorksheetFunction.Today()
At same time
Application.WorksheetFunction.Date(Year,Month,Day)
is an equivalent for VBA function DateSerial, with syntax
DateSerial(Year,Month,Day).
The meaning of this long explanation - don't never forget, that
worksheetfunctions and VBA functions are 2 different collections.