Forum Discussion
Macro button
- Apr 04, 2021
Near the end of the macro, change the part
With wsData.Cells(r, TimeCol + x) .Value = 1 .Interior.Color = vbYellow End Withto
With wsData.Cells(r, TimeCol + x) .Value = .Value + 1 .Interior.Color = vbYellow End WithAnd near the beginning, the line
If Time > TimeSerial(18, 30, 0) And Time < TimeSerial(5, 30, 0) Thenshould be
If Time > TimeSerial(18, 30, 0) Or Time < TimeSerial(5, 30, 0) ThenSee the attached version with the modified version of Subodh_Tiwari_sktneer's code.
One more thing. The count on the data sheet only goes to one. I would like to increase what ever number is there by 1 each time I click the bottom. So if I click it four times in one 15 min period it will show 4.
What I am trying to achieve is to track how many employees and veterans I pick up in my shuttle bus at each of my shuttle stops.
Thanks for your help.
Phil
Near the end of the macro, change the part
With wsData.Cells(r, TimeCol + x)
.Value = 1
.Interior.Color = vbYellow
End With
to
With wsData.Cells(r, TimeCol + x)
.Value = .Value + 1
.Interior.Color = vbYellow
End With
And near the beginning, the line
If Time > TimeSerial(18, 30, 0) And Time < TimeSerial(5, 30, 0) Then
should be
If Time > TimeSerial(18, 30, 0) Or Time < TimeSerial(5, 30, 0) Then
See the attached version with the modified version of Subodh_Tiwari_sktneer's code.
- Subodh_Tiwari_sktneerApr 04, 2021Silver Contributor
Thanks for pointing out the error in logical condition and thanks for tweaking the code. That was a silly mistake, my bad.