Search Results For: debug

Joke: Debugging Definition

LOL: If you want to learn more about VBA debugging, click here: https://vbahowto.com/vba-debug-part-1/ Have a great day! By the way, if you got or are getting value from the VBA information, please give me a tip, thanks!

Continue Reading

VBA Debug Part 2

In this video I talk about VBA Debug aspects like the Immediate Window, Local Window and Watch Window. …also we use the “debug.print” statement to print a value to the Immediate window. The Local Window is useful to view the current state of all the variables present in the current sub procedure. The Watch Window […]

Continue Reading

VBA Debug Part 1

In this video I talk about VBA Debug aspects like setting breakpoints, viewing the current state of variables, and stepping through code. …as well as: Set breakpoints to stop program execution. Test variables in the immediate window. Monitor variable values in the Locals window. Here is the video: Private Sub btnValidate_Click() If IsEmailAddress(Me.txtEmail) Then MsgBox […]

Continue Reading

How To Escape Apostrophe In SQL Update Query

If you are looping a table with thousands of records, you’ll probably run into at least one that has an apostrophe in the field name. Like “Mike’s” or “M’cormick”, or something else. Anyway, here is one way to escape the string when you are doing your update query. Option Compare Database Sub YDriveLoop() ‘4/23/24 erik@loeblcomservices.com […]

Continue Reading

How To Parse A Flat File In Excel VBA

In another post I demonstrated how to access a file on your computer using the MS Office Library. Here it is if you don’t know what I’m talking about. In this post, I am going to show you how to access the file and load it into your spreadsheet. I will do the same thing […]

Continue Reading

How To Exit A VBA Loop

Hi, there are times when you need to exit a loop after a certain condition has been met. How do you exit function in VBA? In the following example, you are going to see how to exit a function in VBA: Sub StartNumbers() Dim intNumber As Integer intNumber = ExitTest ‘the number is going to […]

Continue Reading

Here Is An Example Of The VBA Trim Function

The “Trim” function is useful in eliminating the blank spaces in a string normally caused by some data entry error. Why do you want to do this? Well because a sorting error can happen if you are trying to sort ” Dan, “Fred”, and “Ann”. ” Dan” will show up on top before “Ann” because […]

Continue Reading

VBA Building Dynamic SQL

This video example is going to show you how to generate a SQL string from a form in VBA. [sourcecode language=”vb”] ‘======================================================== ‘DATABASE DESIGNED & CODED BY LOEBLCOM SERVICES 2013 ‘ERIK LOEBL(713)409-7041 ‘EMAIL: erik@loeblcomservices.com ‘WEB: http://loeblcomservices.com ‘======================================================== Option Compare Database ================ form: ================ Private Sub btnFindStocks_Click() Dim strWhere As String Dim strSQL As String Dim […]

Continue Reading

Excel VBA Read Text File

So how can you import the contents of a csv or text file into your Excel worksheet: Find out: ‘======================================================== ‘DESIGNED & CODED BY LOEBLCOM SERVICES 2013 ‘ERIK LOEBL(713)409-7041 ‘EMAIL: erik@loeblcomservices.com ‘WEB: http://loeblcomservices.com ‘======================================================== Sub query_text_file() ‘PURPOSE: Query A Text File ‘************************************* ‘clear ‘Text File Contents’ worksheet ‘************************************* Worksheets("Text File Contents").Select Range("A2:K6500").Clear ‘************************************* ‘now populate […]

Continue Reading

How To Do A VBA CSV Import For One To Multiple Files

So you want to be able to import your csv for 1 to multiple files. Here’s how you do it. 1. up a form with a button. 2. After you click the button, you will get a File Dialog Box that will show you the csv files to choose from: Here is the code behind […]

Continue Reading