visitor sign in register

David899

New Member
Joined
Feb 1, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
I have the following code that copies a range of cells to another worksheet before moving to the next empty row.
target sheet has 4 headers: Date, Name,time in and time out.

Sub Staff_Signin()
'
' Staff_in Macro logs time staff signed in
'
Range("M3:O3").Select
Application.CutCopyMode = False
Selection.Copy
Sheet4.Select

Range("A" & Rows.Count).End(xlUp).Offset(1).Select

ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False


Sheet2.Select
Range("D11").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "1"

Sheet1.Select
MsgBox "Thank You for signing in"

End Sub


i need a piece of code that looks at the first 3 columns and if matched pastes from ("N4") into the time out column without overriding original data.
1675267692116.png


Any help much appreciated.

D
 
Click here for the file. I have modified the Staff sheet to unmerge the merged cells. You should avoid merging cells because they almost always cause problems for macros. I have also deleted the data to the right. When you click on B11, a calendar pops up for the user to select a date. When an initial is selected in C11, the Name and Time In are automatically populated. Clicking the Sign In button copies the data to the Log. Clicking the Sign Out button copies the time to the Log and clears B11 to E11. Give it a try and let me know how it works out.
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Click here for the file. I have modified the Staff sheet to unmerge the merged cells. You should avoid merging cells because they almost always cause problems for macros. I have also deleted the data to the right. When you click on B11, a calendar pops up for the user to select a date. When an initial is selected in C11, the Name and Time In are automatically populated. Clicking the Sign In button copies the data to the Log. Clicking the Sign Out button copies the time to the Log and clears B11 to E11. Give it a try and let me know how it works out.
That's great download worked and i like the calendar but the time out doesn't seem to populate.
 
Upvote 0
Oops! Replace this line of code:
VBA Code:
Sheets("Log").Range("D" & rName.Row) = Format(Range("F11"), "h:mm:ss AM/PM")
with this one:
VBA Code:
Sheets("Log").Range("D" & rName.Row) = Format(Range("E11"), "h:mm:ss AM/PM")
 
Upvote 0
Oops! Replace this line of code:
VBA Code:
Sheets("Log").Range("D" & rName.Row) = Format(Range("F11"), "h:mm:ss AM/PM")
with this one:
VBA Code:
Sheets("Log").Range("D" & rName.Row) = Format(Range("E11"), "h:mm:ss AM/PM")
Works a treat, thanks for the assist. couldn't see the woods for the trees.
huge help

D
 
Upvote 0

Forum statistics

Threads
1,213,521
Messages
6,114,104
Members
448,548
Latest member
harryls

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