Forum Discussion

Phil Cox's avatar
Phil Cox
Copper Contributor
Apr 03, 2021
Solved

Macro button

Hi all. I'm new here. I would like to create a button macro that when I click it, it will go to a cell according to the time (each cell represents a 15 min time) and increase the number in that cell...
  • HansVogelaar's avatar
    HansVogelaar
    Apr 04, 2021

    Phil Cox 

    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.

Resources