Write Data to Text File

Below we will look at a program in Excel VBA that writes an Excel range to a CSV (comma-separated-value) text file. Situation: Place a command button on your worksheet and add the following code lines: 1. First, we declare a variable called myFile of type String, an object called rng of type Range, a variable […]

Read Data from Text File

Below we will look at a program in Excel VBA that reads data from a text file. This file contains some geographical coordinates we want to import into Excel. Situation: 1. First, download the text file and add it to “C:test” Place a command button on your worksheet and add the following code lines: 2. […]

StatusBar

The StatusBar property of the Application object in Excel VBA can be used to indicate the progress of a lengthy macro. This way, you can let the user know that a macro is still running. Situation: The macro we are going to create fills Range(“A1:E20”) with random numbers. Add the following code lines to the […]