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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

LBinGA

Board Regular
Joined
Jan 29, 2014
Messages
57
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.
 

windwardmi

Board Regular
Joined
Oct 18, 2009
Messages
138
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,674
Messages
5,838,711
Members
430,566
Latest member
ChanchalSingh

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
Top