Count Function in Visual Basic (VBA)
Learn to use the Count function using Excel VBA and CommandButtons! We'll use a small data set to count how many cells are numeric using Application.WorksheetFunction.Count, or total number of cells that are not blank using CountA function. The cool thing about this approach is there's no formula to be overwritten or updated, just a static number thanks to Visual Basic in Excel!
Learn more from the full courseThe Ultimate Excel Programmer Course
Learn Excel VBA from Scratch with Dan Strong, Bestselling Excel Expert with Over 180K Students Worldwide!
30:26:37 of on-demand video • Updated November 2021
- Automate and Customize data entry forms
- Choose the right Loop for each task
- Master the CELLS and RANGE objects in multiple scenarios
- Create multiple Variable styles to match your need
- Customize your VBA Editor and Understand all the Toolbars and options
- Debug and Troubleshoot code like a boss!
- Record, Modify or Write Macros from scratch
- Make Custom Formulas/Functions on the fly
- Breeze through IF THEN statements and conquer all the Logical Operators
- Batch out inter-active MessageBoxes, InputBoxes and give users CHOICES!
- Generate Basic Reports that can be printed
- Add filters to report menus to narrow the records
- Take control of forms, Buttons, Drop-down menus, Checkboxes and option buttons AND so much more. . .
- Trigger code from a number of different methods - from Clicking on a cell - to De-Selecting a worksheet.
- Set up Special Commands when a workbook: Opens or closes, is selected, any cell or certain cells are selected, right before printing, etc. . .
- Manipulate Userforms for data entry, report generation, editing tables/databases - ALL within your control. Restrict the flow of data OR make the Userform(s) responsive, calculating, INTUITIVE.
- Streamline your work and the work of others.
- Put Excel ON AUTOPILOT. . .
- Trigger Macros using Worksheet and UserForm Controls (Buttons, Shapes, DropDowns, ListBoxes, Click Actions, Loads of Fun Controls)
- Change Cell Properties using code - Cell Color, Font Properties (Bold, Italic, Underline, etc), Borders and more!
- Master Beginning to Advanced Math with Variables and Learn Proper Use, Declaration and Scope
- Learn String Functions, Concatenation and How to Control Case-Sensitivity with VBA Functions
- Create Your Own Functions to be used In VBA or in a Cell!
- Uncover Advanced Search Functions Only Available in VBA
- Fun with Date and Time Math to Calculate Duration, Length and Intervals
- PROJECTS: Create Full Games, Learn From Coding Exercises and Enjoy Mid-Lecture Challenges!
- Discover and Master the VBE (Visual Basic Editor) and All the Mysterious Buttons and Features Within!
- Deal With Errors and Learn How To Prevent Them
- Feed Information from One Macro to Another using ByRef and ByVal Methods
- Utilize Variable Types: Constants, Static, Module-Level, Public, Private, 'Option Private Module', etc
- BONUS #1: Free e-book "Excel VBA Master Keyboard Shortcuts" - Now with more shortcuts (for PC and Mac) than anywhere else
- BONUS #2: Free Image Tools For Better Looking Buttons, Images and Form Backgrounds
- BONUS #3: Free Mouse Icons Packs To Customize MouseOver Effect on Many Controls Including a UserForm Background!
- Three Methods of Accessing a Worksheet using Code
- Get the Boundaries of a Range of Cells the way Pros do (Better LastRow and LastCol Techniques)
- Dynamically Sort or Filter Data. You can have multiple sort options, each assigned to different buttons!
- Utilize User-Input (MessageBoxes, InputBoxes, UserForms) and Use Conditional Logic (IF THEN, CASE STATEMENTS, AND, OR, NOT) to Control Direction
- Insert Worksheet Functions into Cells Programmatically Using Regular or R1C1 Notation
- Practice Code Slimming and Efficiency Techniques, such as WITH/ END WITH statements
- Speed Up Your Code Massively with Dan's "VBA Speed Hacks"
- Get Random Numbers to Generate Passwords, Create FileNames, Produce Random Actions In Games/Projects, Speed Tests
- Search Cells and Strings with Advanced Pattern Matching & Comparison, LIKE Operator and InStr Functions
- Advanced MessageBox Features (Including Special Icons, Direction, Buttons: Yes/No, Yes/No/Cancel, Abort/Retry and many more...)
- Create Optional UDF Parameters and choose Volatile or Non-Volatile Functionality