Aiden Jenner
New Member
- Joined
- Sep 30, 2024
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hello all,
Please can i get some advice on this: I am trying to create/modify a previous answer by Micron (thank you)
Basically i am trying to create a spreadsheet that records 3 breaks and is for todays date and based 40 colleagues.
The current one has 2 breaks and goes to the next available cell.
I have taken Micron's work and amended it a little to create this so that it works on the activesheet:
Please advise - thank you
Sub FindEmptyInRange()
Dim ws As Worksheet, rng As Range
Dim Lrow As Long
Set ws = ActiveSheet
'not guaranteed but asssume last row will have a value in column A
Lrow = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row
Set rng = ws.Cells.Find("", After:=Range("C" & Lrow), LookAt:=xlPart, LookIn:=xlFormulas, _
SearchOrder:=xlByRows, SearchDirection:=xlNext)
If rng.Column <= 7 And rng.Column >= 3 Then
rng = Time
Else
ws.Range("C" & rng.Row + 1) = Time
End If
Set rng = Nothing
Set ws = Nothing
End Sub
Please can i get some advice on this: I am trying to create/modify a previous answer by Micron (thank you)
Basically i am trying to create a spreadsheet that records 3 breaks and is for todays date and based 40 colleagues.
The current one has 2 breaks and goes to the next available cell.
I have taken Micron's work and amended it a little to create this so that it works on the activesheet:
Please advise - thank you
Sub FindEmptyInRange()
Dim ws As Worksheet, rng As Range
Dim Lrow As Long
Set ws = ActiveSheet
'not guaranteed but asssume last row will have a value in column A
Lrow = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row
Set rng = ws.Cells.Find("", After:=Range("C" & Lrow), LookAt:=xlPart, LookIn:=xlFormulas, _
SearchOrder:=xlByRows, SearchDirection:=xlNext)
If rng.Column <= 7 And rng.Column >= 3 Then
rng = Time
Else
ws.Range("C" & rng.Row + 1) = Time
End If
Set rng = Nothing
Set ws = Nothing
End Sub