Office VBA Macros You Can Use Today phần 3

Kịch bản: Khi xử lý các tập tin lớn với rất nhiều hồ sơ, việc tìm kiếm một cách để xóa tất cả các hàng phù hợp với một điều kiện nhất định có thể là một quá trình cồng kềnh. Vĩ mô này được thiết kế để tạo điều kiện thuận lợi cho nhiệm vụ này, bằng cách thiết lập một cột và một điều kiện để phù hợp để xóa các | Excel Procedures Exl Did the user cancel fl If TypeName sReplace Boolean Then Exit Subfl Turn off screen updatingfl Falsefl Loop through the workbooksfl For Each Book In Workbooksfl For Each WS In What CStr sFind _fl Replacement CStr sReplace LookAt xlPart _fl SearchOrder xlByRows MatchCase Falsefl Next WSfl Next Bookfl Restore screen updatingfl Truefl End Subfl Tip This macro requires no changing of variables because the variables are changed through an input box provided to the user. Converting Data to a Tabular Format With this macro you can convert data into a format that helps utilize the built-in features of Excel. Scenario Inputting information and analyzing it are two very different things. What could be a good layout for data entry might be a bad one for analyzing data. A survey is a typical example presented to the participant looking like this Example file Figure 30 - Great Data Layout for Data Entry page 76 Office VBA Macros You Can Use Today Excel Procedures Scenario continued However this layout does not allow you to compile and analyze the data efficiently with Excel. This macro converts the previous data into a more useful format that can be analyzed with Excel s built-in tools. Exl M N I 0 I p 1 Survey Question Value 2 1 ABC- 001 Question 1 3 3 1 ABC-001 Question 2 1 4 1 ABC-001 Question 3 3 5 1 ABC-001 Question 4 5 6 1 ABC - 001 Question 5 2 7 2 ABC - 002 Question 1 2 8 2 ABC-002 Question 2 1 9 2 ABC - 002 Question 3 4 10 2 ABC-002 Question 4 3 11 2 ABC - 002 Question 5 4 Figure 31 - Great Data Layout for Data Analysis View the Appendix to learn how to store this procedure in a Standard module. Option Explicitfl fl Sub DataToTabular fl Variable declarationfl Dim RngOrig As Rangefl Dim RngDest As Rangefl Dim FixedColumnCount As Longfl Dim VarColumnCount As Longfl Dim i As Longfl On Error Resume Nextfl Ask for the datafl Set RngOrig

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
34    62    1    28-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.