Hello,
This workbook, with VBA was found on the web (it could even be from here, for all I know). I can't locate the link. Anyway, What it does it load one column with False on each row, all the way down...and the VBA code then turns one row at a time into True. The rest of the workbook can then have it's data, based on if that row is True of not. If it's true then it plots the data, and if not then it gives an NA(). This way, a chart of the data, will show it adding data, one point at a time, each time the button is pushed.
However, what I need it to change more than one row to True, per click of the button. Right now its too slow. I know that in the code "x" is the row, and it increases by x+1, to get to the next row, but that's about all I know. (VBA is fairly new to me, but I have a little programming experience). Could you please help me to slightly alter this, so that more rows are turned to True, with each click of the button? (or some other means). I will learn so much just by seeing what it is that you changed. Thank you very much for taking a moment !
animatedchart.xlsm
.....and here is a copy of the VBA :
Sub changeVal()
'set up parameters
With ThisWorkbook.Worksheets(1)
lastR = .UsedRange.Rows.Count
x = 1
Do
x = x + 1
Loop Until .Cells(x, 3) = False Or x > lastR
If x <= lastR Then
.Cells(x, 3) = True
End If
End With
End Sub
Sub changeValAuto()
'set up parameters
With ThisWorkbook.Worksheets(1)
wt = .Cells(1, "N")
lastR = .UsedRange.Rows.Count
x = 2
Do
.Cells(x, 3) = True
Application.Calculate
setAt = Now
waitTill = DateAdd("s", wt, setAt)
Do
Loop Until waitTill < Now
x = x + 1
Loop Until .Cells(x, 1) = ""
End With
End Sub
Sub SetToFalse()
'set up parameters
With ThisWorkbook.Worksheets(1)
lastR = .UsedRange.Rows.Count
x = 2
Do
.Cells(x, 3) = False
x = x + 1
Loop Until .Cells(x, 1) = ""
End With
End Sub
Bookmarks