So I am trying to create a spreadsheet to track employee holidays.
I have got an idea of how I want it to work when it is finished however, I am having trouble with getting certain aspects to work so this might be quite a long post, and I apologies for that in advance.
So firstly, I have set up a user form with four buttons. One for a full day off, one for half a day off and one for public holiday and other. I would like to have it set so that when I select cells i can open the user form and click what type of holiday it is and it will add the value to the cells that are selected. I have only been able to get it to add the value and change colour of the active cell and cant get it to change the value in all selected cells.
This is the current code in the Full Day button:
Private Sub CommandButton1_Click()
ActiveCell.Value = ActiveCell.Value + 1
Selection.Interior.ColorIndex = 8
ActiveSheet.Range("E5:JF34").Font.Color = RGB(0, 255, 255)
End Sub
I also have the issue that when I add a full day for example and then try to add a half day on a diffrent day it will change the text colour in the full days also.
Here is the code in the half day button:
Private Sub CommandButton2_Click()
ActiveCell.Value = ActiveCell.Value + 0.5
Selection.Interior.ColorIndex = 46
ActiveSheet.Range("E5:JF34").Font.Color = RGB(255, 102, 0)
End Sub
Then I would also like to make a clear button that allows me to get rid of values and colours in the selected cells only, I have so far only been able to get it to clear the whole spreadsheet which doesn't work for what this is for. Unfortunately got rid of this code out of frustration so will have to start from scratch for this one unfortunately.
I have got an idea of how I want it to work when it is finished however, I am having trouble with getting certain aspects to work so this might be quite a long post, and I apologies for that in advance.
So firstly, I have set up a user form with four buttons. One for a full day off, one for half a day off and one for public holiday and other. I would like to have it set so that when I select cells i can open the user form and click what type of holiday it is and it will add the value to the cells that are selected. I have only been able to get it to add the value and change colour of the active cell and cant get it to change the value in all selected cells.
This is the current code in the Full Day button:
Private Sub CommandButton1_Click()
ActiveCell.Value = ActiveCell.Value + 1
Selection.Interior.ColorIndex = 8
ActiveSheet.Range("E5:JF34").Font.Color = RGB(0, 255, 255)
End Sub
I also have the issue that when I add a full day for example and then try to add a half day on a diffrent day it will change the text colour in the full days also.
Here is the code in the half day button:
Private Sub CommandButton2_Click()
ActiveCell.Value = ActiveCell.Value + 0.5
Selection.Interior.ColorIndex = 46
ActiveSheet.Range("E5:JF34").Font.Color = RGB(255, 102, 0)
End Sub
Then I would also like to make a clear button that allows me to get rid of values and colours in the selected cells only, I have so far only been able to get it to clear the whole spreadsheet which doesn't work for what this is for. Unfortunately got rid of this code out of frustration so will have to start from scratch for this one unfortunately.