Create report in sheet from db in another sheet

windwardmi

Board Regular
Joined
Oct 18, 2009
Messages
138
I am working with my employees with Office 365.

I have a Excel workbook that can collect an employee's day time sheet and keep populating their sheet using a userform.

I want to pull data off their sheet and input on another sheet after header rows and before total rows.

Any help in doing this would be appreciated.

Thanks Steve....
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I am working with my employees with Office 365.

I have a Excel workbook that can collect an employee's day time sheet and keep populating their sheet using a userform.

I want to pull data off their sheet and input on another sheet after header rows and before total rows.

Any help in doing this would be appreciated.

Thanks Steve....

If I'm understanding correctly...try this:

Code:
Sub Copyto()


Dim ws As Worksheet
Dim ws2 As Worksheet
Dim rngEENameAs Range
Dim rngPaste As Range
Dim LR As Long


Set ws = Worksheets("Your WS From")
Set ws2 = Worksheets("Your WS To")


ActiveSheet.Unprotect


'***Copy EE Name
Set rngCopyIns = ws.Range("Range where the EE Name is")
If ws2.Range("A2").Value = "" Then 'Assuming your header is in Row 1 _
    Set rngPaste = ws2.Range("A2")
Else
    LR = ws2.Cells(Rows.Count, "A").End(xlUp).Row + 1
    Set rngPaste = ws2.Range("A" & LR)
End If


rngCopyIns.Copy
rngPaste.PasteSpecial xlPasteValues
rngCopyIns.Value = ""
rngCopyIns.Cells(1).Select
Application.CutCopyMode = False

ActiveSheet.Protect
End Sub

Repeat for each field you wish to copy. I assume this sheet is on a network and all employees are using the same sheet.

Attach this code to a button on main form.
 
Upvote 0
Assigned following to button:
Code:
ub TestBtn()
Dim ws As Worksheet
Dim ws2 As Worksheet
Dim rngEEName As Range
Dim rngPaste As Range
Dim LR As Long

Set ws = Worksheets("Steve")
Set ws2 = Worksheets("TimeSheetTest")

ActiveSheet.Unprotect

'***Copy EE Name
Set rngCopyIns = ws.Range("A3:Q11")
If ws2.Range("A3").Value = "" Then 'Assuming your header is in Row 1 _
    Set rngPaste = ws2.Range("A3")
Else
    LR = ws2.Cells(Rows.Count, "A").End(xlUp).Row + 1
    Set rngPaste = ws2.Range("A" & LR)
End If

rngCopyIns.Copy
rngPaste.PasteSpecial xlPasteValues
rngCopyIns.Value = ""
rngCopyIns.Cells(1).Select
Application.CutCopyMode = False
ActiveSheet.Protect
End Sub

I then get a Run Time error 91. Highlighted is rngPaste.PasteSpecial xlPasteValues

Am I missing something.
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,797
Members
449,048
Latest member
greyangel23

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