Excel 2002 Formulas phần 9

N ví dụ đơn giản chức năng tùy chỉnh NA chức năng tùy chỉnh để xác định một kiểu dữ liệu của tế bào NA chức năng tùy chỉnh để làm một bảng chức năng duy nhất như nhiềuNA tùy chỉnh chức năng để tạo ra các số ngẫu nhiên và lựa chọn các tế bào ở | Chapter 25 VBA Custom Function Examples IN THIS CHAPTER Simple custom function examples A custom function to determine a cell s data type A custom function to make a single worksheet function act like multiple functions A custom function for generating random numbers and selecting cells at random Custom functions for calculating sales commissions Custom functions for manipulating text Custom functions for counting and summing cells Custom functions that deal with dates A custom function example for returning the last nonempty cell in a column or row Custom functions that work with multiple worksheets Advanced custom function techniques This chapter is jam-packed with a wide variety of useful or potentially useful VBA custom functions. You can use many of the functions as they are written. You may need to modify other functions to meet your particular needs. For maximum speed and efficiency these function procedures declare all variables that are used. Simple Functions The functions in this section are relatively simple but they can be very useful. Most of them are based on the fact that VBA can obtain lots of useful information that s not normally available for use in a formula. For example your VBA code can access a cell s HasFormula property to determine whether a cell contains a formula. Oddly Excel does not have a built-in worksheet function that tells you this. 653 654 Part VI Developing Custom Worksheet Functions ON THE CD The companion CD-ROM contains a workbook that includes all of the functions in this section. Does a Cell Contain a Formula The following CELLHASFORMULA function accepts a single-cell argument and returns TRUE if the cell has a formula. Function CELLHASFORMULA cell As Boolean Returns TRUE if cell has a formula CELLHASFORMULA A1 .HasFormula End Function If a multi-cell range argument is passed to the function the function works with the upper-left cell in the range. Returning a Cell s Formula The following CELLFORMULA function .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
2    212    1    29-04-2024
Đã 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.