VBA copy values to next column with an existing table

Ulraan

New Member
Joined
Dec 12, 2021
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
Hello

I have a workbook name time_card_calulator and time card

i wan to export the total hours to the time card in such a way that it will be adding up data from monday to friday over and over weekly when data is being export depending on day.
but each time it adds up out of the table i created . Help please.
VBA Code:
Private Sub Export_Data()
'Macro to copy random results to next blank period
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet

Set copySheet = Worksheets("Time_card_calculator")
Set pasteSheet = Worksheets("Time_card")

    copySheet.Range("D2:D30").Copy
        If pasteSheet.Cells(2).End(xlToLeft) = "" Then
            pasteSheet.Cells(2).End(xlToLeft).Offset(0, 3).PasteSpecial xlPasteValues
        Else
            pasteSheet.Cells(2, Columns.Count).End(xlToLeft).Offset(0, 1).PasteSpecial xlPasteValues
        End If

Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
 

Attachments

  • time_card calculator.png
    time_card calculator.png
    67.6 KB · Views: 17
  • time_card.png
    time_card.png
    46.7 KB · Views: 14

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

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