Attendance register

slinger42

New Member
Joined
Oct 29, 2022
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
I have used a UDF in my register system as shown below, and it works well.

However, I need it to ignore the characters 'O' (Thats the letter O by the way), and the character "W" if entered in a Row, and if either are entered the original date is left unchanged. In other words, the true last date of attendance is not changed if the O or the W is entered.

Function DateofLastAttendance(mDates, mTimes As Range)
Dim mCol As Integer
For Each cell In mTimes
If cell.Value <> vbNullString Then
mCol = cell.Column
End If
Next cell
DateofLastAttendance = Cells(mDates.Row, mCol)
End Function
I have tried so many ways to implement this I have become confused, and any help would be much appreciated.

Looking forward to any reply that can guide me as to how to achieve this.

Regards
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Maybe the test should be more like If cell <> vbNullString And cell <> "O" And cell <> "W" ?

If that's not what you meant, copy/paste a range from a sheet that shows what you have and the result you want.
 
Upvote 0
Solution
Maybe the test should be more like If cell <> vbNullString And cell <> "O" And cell <> "W" ?

If that's not what you meant, copy/paste a range from a sheet that shows what you have and the result you want.
Ji Micron.
Many Many thanks for the suggestion. Have modified it and it works perfectly now. I just did not think to add the AND statements to the vbNullString !! Spent so much time adding and removing statements both before and after it to no avail. Can move forward now. Once again thanks ever so much !!
 
Upvote 0
So Sorry Micron !!! First time here. To excited I actual have got this one solved. Sorted now I hope. Thanks again!!!
 
Upvote 0

Forum statistics

Threads
1,214,553
Messages
6,120,179
Members
448,948
Latest member
spamiki

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