rhino4eva
Active Member
- Joined
- Apr 1, 2009
- Messages
- 262
- Office Version
- 2010
- Platform
- Windows
Code:
Sub punchclock()
Dim ws As Worksheet
Dim rFound As Range
datenow = Format(Now(), "ddd dd")
timenow = Format(Now(), "hh:mm")
Set ws = Sheets("Sheet1")
With ws.Range("c1:f33")
On Error Resume Next
Set rFound = .Find("*", SearchDirection:=xlPrevious, SearchOrder:=xlByColumns, LookIn:=xlValues)
On Error GoTo 0
If rFound Is Nothing Then
.Cells(1).Value = timenow
ElseIf Intersect(rFound, .Cells(.Rows.Count, .Columns.Count)) Is Nothing Then
If rFound.Row < .Rows(.Rows.Count).Row Then
rFound.Offset(1, 0).Value = timenow
Else
rFound.Offset(.Rows.Count + 1, 1).Value = timenow
End If
Else
MsgBox "No empty cell found within " & .Address(0, 0) & ".", vbInformation
End If
End With
End Sub
I am trying modify some code that a fellow Mr excel forum user gave me
I have got it to add a time stamp every time it's run in to the next empty cell in column as it goes down from c1 to c33 then back up to d2 down to d33 etc.
my problem is two fold
1)How do I make go across 4 columns and then go onto the next row.
2)I have set a datenow variable in the hope I will be able search down column b and start the time stamping in in columns c,d,e,f
any help would be gratefully received
Last edited by a moderator: