Employee LogBook

Kmit37

New Member
Joined
Mar 14, 2011
Messages
10
I am trying to make a excel based logbook for my employees so that I can get rid of paper based logs of daily output.

I want to have a button with a macro for each new log entry called "New Log Entry'

So far this is the VBA I have to auto fill date and time of entry

LogEntry Macro
'
'
Range("B6").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Range("C6").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Range("D7").Select
End Sub

My problem is that I need this macro to move to the next empty row and run =NOW() in colum B and C of that empty row respectively. This macro would then leave the cursor or active cell in row D of the empty row.

Thanks, any help would be greatly appreciated.

Kmit37
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Welcome to MrExcel board...

try this
Code:
LogEntry Macro
Dim LR As Long
LR = ActiveSheet.Range("B" & Rows.Count).End(xlUp).Row + 1
'
'
Range("B" & LR).FormulaR1C1 = "=NOW()"
Range("C" & LR).FormulaR1C1 = "=NOW()"
Range("D" & LR).Select
End Sub
 
Upvote 0
Welcome to the Board!

Instead of using NOW(), I'd use NOW, which will enter a static date/time, as NOW() will continue to update.

.Value = Now

HTH,
 
Upvote 0
question - do you really want the date to be a formula? or would you just want the date the macro was executed. Since if you open the file on a different date, the cell value doesn't change.

Range("B" & LR).FormulaR1C1 = Date
Range("C" & LR).FormulaR1C1 = Date
 
Upvote 0
Thanks guys,

Yes, the .value = Now works better and makes each log entry a unique punch as opposed to the now() which changed after each time the macro was run.

Thanks Again!

Kmit37
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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