Need Some Help

Josh_Else

New Member
Joined
Oct 9, 2018
Messages
1
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.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top