Posts by skywriter

    Re: Set the value of the current row and column to a cell

    So this is a command button on the sheet Enter and you want it to take the value of the cell that is selected and copy that into cell A2. If not please explain further. Target is usually passed to a worksheet event like selection change or change.

    Try this code. If the button is on sheet Enter and the cell you want the value from is the active cell then it will give you the value from that cell.

    1. Private Sub CommandButton1_Click()
    2. Sheets("Enter").Cells(2, 1) = ActiveCell.Value
    3. End Sub

    Re: Count Consecutive Days Worked For Each Employee

    Okay this spreadsheet has a custom function called ConsecutiveDaysWorked.
    It's already in place on the spreadsheet.
    You have three arguments as you will see in the cells that the function is installed in.
    The first is the cell with the employee number, the second is the by date cell and then the third is the entire range of data in the A and B columns.

    When you use it if you go up to the left of the formula bar where you see the fx and click on the fx and choose user defined in the drop down box labeled "Or select a category:" and click on the ConsecutiveDaysWorked function then you will get more guidance as to what to put into each argument. You will see three boxes with what the arguments are. You could type in the cell references or the better method would be to use your mouse to select the ranges to put in each box.

    Good Luck,
    Bruce :cool:

    I forgot to mention your dates have to be in order from low to high for each employee.
    It doesn't mean to sort all the 1/1/2015 together, it just means for a given employee they have to be in order from low to high as they go up the list. It's perfect the way it is now, but if you were to have an entry for an employee that's out of date order it will cause an error.

    The highlighting yellow and red that you want to do is just conditional formatting that looks at a cells value and does what you want. You can look in the help menu or post a separate thread and I or I'm sure someone else will tell you how to do it.
    Right now I need to sleep.