[Part 1 - Original question]
I have values like 30, 31, 28 or 29 which are total days of the month.
I want to make a for loop
If I select 28 it should display a msgbox 28 times.
If I select 31 it should display a msgbox 31 times.
The code I tried:
Dim dayst As Variant
Dim tot1 As Variant
tot1 = DateDiff("d", "01/2011", DateAdd("m", 1, "01/2011"))
tot1 = Split(tot1, ",")
For Each dayst In tot1
MsgBox dayst
Next
The above code is showing “31” in the msgbox, instead of 31 times like “1”, “2”, … “31”
I want to display a msgbox 31 times incrementing from 1 to 31.
[Part 2 - Updated request]
Default Column Value Example
ID 1 2 ..... 31 totaldays
001 Yes Yes .... Yes 31
002 Yes Yes .... Yes 31
003 Yes Yes .... Yes 31
.....
001 is coming from table
Yes is the default column value for 1 to 31 or 1 to 28
totaldays should be no of days permonth.
How can I accomplish this using vb6.
You could just use a simple loop like this – although I dont see why you would want to have 28-31 MsgBox prompts in a row
Updated version - adds early exit option