rinneii
New Member
- Joined
- Mar 20, 2019
- Messages
- 18
EDIT: I meant VBA !!! I tried doing VBA: but I ended up putting an L instead >_>
For one of my assignments I need to do as follows:
Obtain winning numbers through last row in column G: Type Winner in column G for any row you choose. Write a macro to capture the six winning numbers in that row in an array, and display in H3:H8 with a header “Winning Numbers” in H2.
Solution
DIM statements: lottery(1 to 6) as Integer; i as Integer, j As Integer, Lrow As Integer, wn_header As String
Delete column H to erase any numbers in column H
Use the last row technique to find the row with Winner in column G, and put it in variable Lrow
For-Next loop from column A to column F to capture winning numbers in lottery(1) to lottery(6). Designate ranges with Cells(row,column). Use Lrow for the row, and counter i for the column.
Put text “Winning Numbers” in variable wn_header
Put wn_header in cell H2
For-Next loop to enter lottery(1) to lotter(6) in cells H3:H8. Use counter starting at 3, and going to 8 (place in row position of Cells way of addressing ranges). Column position is 8.
I'm having issues with the for next loop. I'm not exactly sure how to do it :'|
Here's the data we start off with. I added "Winner" already.
<tbody>
</tbody>
For one of my assignments I need to do as follows:
Obtain winning numbers through last row in column G: Type Winner in column G for any row you choose. Write a macro to capture the six winning numbers in that row in an array, and display in H3:H8 with a header “Winning Numbers” in H2.
Solution
DIM statements: lottery(1 to 6) as Integer; i as Integer, j As Integer, Lrow As Integer, wn_header As String
Delete column H to erase any numbers in column H
Use the last row technique to find the row with Winner in column G, and put it in variable Lrow
For-Next loop from column A to column F to capture winning numbers in lottery(1) to lottery(6). Designate ranges with Cells(row,column). Use Lrow for the row, and counter i for the column.
Put text “Winning Numbers” in variable wn_header
Put wn_header in cell H2
For-Next loop to enter lottery(1) to lotter(6) in cells H3:H8. Use counter starting at 3, and going to 8 (place in row position of Cells way of addressing ranges). Column position is 8.
I'm having issues with the for next loop. I'm not exactly sure how to do it :'|
Here's the data we start off with. I added "Winner" already.
Num 1 | Num 2 | Num 3 | Num 4 | Num 5 | Powerball | Status |
51 | 35 | 48 | 22 | 5 | 2 | |
13 | 47 | 39 | 49 | 57 | 19 | |
29 | 59 | 50 | 63 | 7 | 1 | |
58 | 66 | 35 | 57 | 17 | 18 | |
47 | 56 | 37 | 66 | 22 | 15 | |
2 | 9 | 63 | 12 | 14 | 11 | |
50 | 58 | 59 | 48 | 31 | 8 | |
57 | 31 | 40 | 44 | 55 | 15 | |
26 | 64 | 50 | 23 | 67 | 9 | |
40 | 26 | 36 | 42 | 3 | 26 | |
62 | 32 | 27 | 34 | 39 | 4 | |
36 | 45 | 57 | 67 | 50 | 3 | |
30 | 25 | 28 | 65 | 56 | 11 | |
7 | 3 | 64 | 4 | 67 | 7 | |
16 | 45 | 58 | 32 | 29 | 26 | Winner |
63 | 1 | 60 | 38 | 40 | 8 | |
44 | 34 | 69 | 36 | 15 | 9 | |
25 | 56 | 63 | 43 | 4 | 9 | |
35 | 67 | 3 | 69 | 61 | 15 | |
5 | 49 | 4 | 28 | 32 | 22 | |
25 | 64 | 22 | 50 | 31 | 9 |
<tbody>
</tbody>
Last edited: