Join Curt Frye for an in-depth discussion in this video Finding values in cells, part of Learning VBA in Excel.
Some subroutines rely on your data containing a specific value;…for example, you might want to return the date the Two Trees sold their first…bottle of Basil-infused olive oil.…You can press Ctrl+F to use the Find dialog box through the user interface, but…you can also find values using VBA code.…So I'll switch over to the Visual Basic Editor, Alt+F11.…To find the first occurrence of the value within a worksheet, you must use the…Range Object's Find method to locate the value.…The code you use appears here, in the FindThisValue subroutine.…
The first thing I do is display an Input Box that asks the user for the…value they want to find.…Next, I use an On Error statement to tell the program that in case there is…an error, then it should go to the line with the label Handler, and that is down here.…So if the user types in a value that does not occur within the worksheet, we…come down here to Handler and display a Message Box called Value not found.…So that's the error handling, but the next line is how we find the value…
- Working in the Visual Basic Editor
- Adding code to a macro
- Creating, exporting, and deleting code modules
- Declaring and using variables
- Managing variable scope
- Defining arrays
- Managing workbooks and worksheets with VBA
- Repeating tasks with loops
- Debugging VBA code
- Cutting, copying, and pasting cell data
- Running and triggering event procedures
Skill Level Advanced
Excel 2010: Tips, Tricks, and Shortcutswith Dennis Taylor3h 43m Intermediate
1. Introducing Visual Basic for Applications (VBA)
2. Defining Variables, Constants, and Calculations
3. Adding Logic to Your VBA Code
4. Debugging Your VBA Code
5. Managing Workbook Elements and Data in VBA
6. Adding Advanced Elements to Your Workbook
7. Using Excel Events in Your VBA Code
8. Putting It All Together
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.