At the point when lottery specialists need to test a hypothesis, it’s a smart thought to so some testing on some genuine information. An ordinary situation is to discover events of explicit numbers in late outcomes.

This article discloses how to utilize VBA to precisely feature explicit numbers over ongoing draws.

Making The Initial Parameters For The VBA Program

We’ll have to build up three principle factors.

The underlying informational collection of results

Where the investigation should begin from

The rundown of numbers to search for

The information should look something like this:

8 19 26 29 30 33

2 9 12 22 35 39

6 9 12 19 20 31

5 16 20 22 27 29

18 20 35 15 31 2

3 19 20 27 31 35

Next, we have to consider the subset of information to examine; in this precedent we’ll take the last four lines. At long last, we have to characterize the numbers the code should search for.

Making The VBA Code And Highlighting The Selected Numbers

To begin with, we’ll move to where the information is held and make a range. The range is only the information that we need the code to travel through. We’ll expel the arranging so our code begins again without any preparation each time we run it.

Diminish rng As Range




Next, we’ll tell the VBA code what number of columns from the base we need to utilize; we’re instructing it to take a gander at the last 4 draws.

Additionally, we’ll characterize the paremeters of the information, the quantity of sections and lines. This will enable us to make the information go.

myRows = 4

allRows = ActiveCell.End(xlDown).Row

allcols = ActiveCell.End(xlToRight).Column

startRow = allRows – myRows + 1

Presently we can really choose the information. If you somehow managed to end the program here, you’d see the last four columns of information chosen by the cursor.

add1 = Range(“a” and startRow).Address

add2 = ActiveCell.Offset(allRows – 1, allcols – 1).Address

Set rng = Range(add1, add2)


With our information chose, we have to characterize our chosen numbers, go through the choice and feature any numbers found.

myNumbers = “,5,27,”

For x = 1 To rng.Rows.Count

For y = 1 To rng.Columns.Count

testNo = “,” and rng.Cells(x, y) and “,”

On the off chance that InStr(myNumbers, testNo) > 0 Then

rng.Cells(x, y).Font.Bold = True

End If



The code above is alluded to as a settled circle; it’s experiencing the information push by line and segment by segment to discover the numbers. In this precedent any numbers found are changed to an intense textual style.

One critical point is for the code to recognize the genuine number and not befuddle numerals, for example, 5 and 35. That is the reason the pursuit code includes a comma around the numbers so it scans for “,5,” and not only “5”. Get more Details pre setup spreadsheet


Despite the fact that Excel has its own restrictive arranging instruments, for lotto examine the standard devices won’t generally carry out the responsibility, particularly for increasingly complex thoughts and speculations. This is the place a little learning of VBA can take your lotto research higher than ever.

Copyright © 2015 Pixel Theme Studio. All rights reserved.