TAILIEUCHUNG - Introduction to using macros in Microsoft Excel 2003 phần 5

đưa ra một định dạng in đậm để các nội dung của tất cả các tế bào trong hàng thứ hai của Week4 tờ bảng tính đang hoạt động. Lưu ý: Nó có thể làm việc với các hàng hoặc cột cùng một lúc bằng cách sử dụng phương pháp của Liên minh (không được thảo luận trong tài liệu này). | positioned about one-third of the way down . It is also measured in twips. helpfile is optional and controls which Help file is to be used. If helpfile is included a value for context must also be provided. context is optional and is the Help context number. If context is included a value for helpfile must also be provided. A twip is one twentieth of a point. There are 72 points in an inch. If values for more than just prompt are included InputBox must be part of an expression. Examples of macro instructions Example 1 MsgBox n will display on screen the current value of n in the macro. Example 2 MsgBox Tax to be paid is TotalTax will display something like T ax to be paid is Example 3 myAnswer MsgBox Reached end of first data set. Continue _ vbOKCancel Analysing data will produce the following message box When one of the buttons is clicked the message box closes and a corresponding value is returned to the macro. This value can then be used as in If myAnswer vbCancel Then Exit Sub Example 4 The line of code nPoints InputBox Enter number of points to be used _ Data Selection Guide 39 Introduction to using macros in Microsoft Excel 2003 37 will produce the following message box It is important to note that this function returns a string containing what you typed. Most of the time Visual Basic will not mind if you use the response as though it were a number as in the example below . nPoints InputBox Enter number of points to be used _ Data selection total 0 For x 1 To nPoints The For . Next x total total x structure is discussed Next x in Section 11 MsgBox total Should it be necessary you can convert the text to a number using the VAL function as in n VAL nPoints Note Exercises in section 11 will give you the chance to use MsgBox in a macro. 11 Repeating actions loops Loops and If statements are known as control structures. A loop allows a group of statements to be run several times. Three kinds of loop will be considered at this stage Do For Next For Each

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.