Executing sample VBA with RDCOMClient
For this execution, the first thing we will need is a new workbook. Let’s call it mult_by_rand_ch3
.
On Sheet1, we can create two columns, one called Record
and the other called Value
. These columns will simply be the numbers 1 through 10. When that is done, we will need to go ahead and create a simple VBA script to execute from the RDCOMClient
library.
We are going to write a macro that will take the Value
column and then multiply the number by a random number using the RAND()
function.
Let’s go over the steps to make the macro and describe how it works. First, take a look at the following VBA code:
Sub MultiplyByRandom() Dim rng As Range Dim cell As Range ' Set the range to the desired range on Sheet1 Set rng = Sheets("Sheet1").Range("B2:B11") ' Loop through each cell in...