Hỏi về ý nghĩa hàm macro 4

Liên hệ QC

challenge98

Thành viên chính thức
Tham gia
21/6/09
Bài viết
90
Được thích
5
Ai biết sử dụng hàm Argument cho em hỏi với em không hiểu hàm này dùng để làm gì? đọc tiếng anh mãi chẳng hiểu.
 
Bạn xem Từ điển Lạc Việt giải thích:
Argument: Những từ, những câu, hoặc những số mà bạn đưa vào trên cùng một dòng với một lệnh hoặc câu lệnh để mở rộng hoặc cải biến cách hoạt động của lệnh hoặc câu lệnh đó.

Bạn thấy các Hàm chẳng hạn, các đối số đưa vào trong ngoặc để làm căn cứ thực hiện hàm chính là đối số.
Như vậy nó không phải là hàm.
 
Bạn xem Từ điển Lạc Việt giải thích:
Argument: Những từ, những câu, hoặc những số mà bạn đưa vào trên cùng một dòng với một lệnh hoặc câu lệnh để mở rộng hoặc cải biến cách hoạt động của lệnh hoặc câu lệnh đó.

Bạn thấy các Hàm chẳng hạn, các đối số đưa vào trong ngoặc để làm căn cứ thực hiện hàm chính là đối số.
Như vậy nó không phải là hàm.
Nó là hàm XL4 mà anh
Nó đây:
ARGUMENT
Macro Sheets Only
Describes the arguments used in a custom function, which is a type of macro, or in a subroutine. A custom function or subroutine must contain one ARGUMENT function for each argument in the macro itself. There are two forms of the ARGUMENT function. In the first form, only name_text is required; in the second form, only reference is required. Use the first form if you want to store the argument as a name. Use the second form if you want to store the argument in a specific cell or cells.

Syntax 1

For name storage
ARGUMENT(name_text, data_type_num)

Syntax 2

For cell storage
ARGUMENT(name_text, data_type_num, reference)
Name_text is the name of the argument or of the cells containing the argument. Name_text is required if you omit reference.
Data_type_num is a number that determines what type of values Microsoft Excel accepts for the argument. The following table lists the possible data types.

Data_type_num Type of value

1 Number
2 Text
4 Logical
8 Reference
16 Error
64 Array

Data_type_num can be a sum of the preceding different numbers to allow for more than one possible type of data. For example, if data_type_num is 7, which is the sum of 1, 2, and 4, then the value can be a number, text, or logical value.
Data_type_num is an optional argument. If you omit data_type_num, it is assumed to be 7.
If the value that is passed to the function macro is not of the type specified by data_type_num, Microsoft Excel first attempts to convert it to the specified type. If the value cannot be converted, the macro returns the #VALUE! error value.

Reference
is the cell or cells in which you want to store the argument's value.

If you specify reference, the value that is passed to ARGUMENT is entered as a constant in the specified cell, and name_text becomes an optional argument because you can refer to the cell with either reference or name_text.
If you omit reference, name_text is defined on the macro sheet and refers to the value that is passed to ARGUMENT. Once name_text is defined, you can use it in formulas.

Remarks

Custom functions and subroutines can accept from 1 to 29 arguments.
If a macro contains an ARGUMENT function and you omit the corresponding argument in the function that starts the macro, the macro uses the #N/A error value as the value of the argument.

Examples


To create a custom function that calculates profit, use the following functions to specify arguments for cost, sales, and sales volume:

ARGUMENT("UnitsSold", 1)
ARGUMENT("UnitCost", 1)
ARGUMENT("UnitPrice", 1)
 
ARGUMENT

Describes the arguments used in a custom function, which is a type of macro, or in a subroutine. A custom function or subroutine must contain one ARGUMENT function for each argument in the macro itself. There are two forms of the ARGUMENT function. In the first form, only name_text is required; in the second form, only reference is required. Use the first form if you want to store the argument as a name. Use the second form if you want to store the argument in a specific cell or cells.
Syntax 1
For name storage
ARGUMENT(name_text, data_type_num)
Syntax 2
For cell storage
ARGUMENT(name_text, data_type_num, reference)
Name_text is the name of the argument or of the cells containing the argument. Name_text is required if you omit reference.
Data_type_num is a number that determines what type of values Microsoft Excel accepts for the argument. The following table lists the possible data types.
Data_type_num
Type of value
1
Number
2
Text
4
Logical
8
Reference
16
Error
64
Array


·[FONT=&quot] [/FONT]Data_type_num can be a sum of the preceding different numbers to allow for more than one possible type of data. For example, if data_type_num is 7, which is the sum of 1, 2, and 4, then the value can be a number, text, or logical value.
·[FONT=&quot] [/FONT]Data_type_num is an optional argument. If you omit data_type_num, it is assumed to be 7.
·[FONT=&quot] [/FONT]If the value that is passed to the function macro is not of the type specified by data_type_num, Microsoft Excel first attempts to convert it to the specified type. If the value cannot be converted, the macro returns the #VALUE! error value.

Reference is the cell or cells in which you want to store the argument's value.
·[FONT=&quot] [/FONT]If you specify reference, the value that is passed to ARGUMENT is entered as a constant in the specified cell, and name_text becomes an optional argument because you can refer to the cell with either reference or name_text.
·[FONT=&quot] [/FONT]If you omit reference, name_text is defined on the macro sheet and refers to the value that is passed to ARGUMENT. Once name_text is defined, you can use it in formulas.

Remarks
·[FONT=&quot] [/FONT]Custom functions and subroutines can accept from 1 to 29 arguments.
·[FONT=&quot] [/FONT]If a macro contains an ARGUMENT function and you omit the corresponding argument in the function that starts the macro, the macro uses the #N/A error value as the value of the argument.

Examples
To create a custom function that calculates profit, use the following functions to specify arguments for cost, sales, and sales volume:
ARGUMENT("UnitsSold", 1)ARGUMENT("UnitCost", 1)ARGUMENT("UnitPrice", 1) Related Functions
RESULT Specifies the data type a custom function returns
VOLATILE Makes custom functions recalculate automatically
Mình dịch hiểu thế này không biết có đúng không ví dụ
=Argument("ten1",1) 'lưu tên 1 vào thành biến dạng số
=Argument("ten2",2) 'lưu tên 2 vào thành biến dạng text (chữ)
Không biết có đúng không và nó để làm gì nhỉ?
 
Web KT
Back
Top Bottom