Macro that updates billed amounts and worked hours for employees

robertmihai717

New Member
Joined
Sep 20, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,

Can someone help me with a macro for monthly employee worked hours and billed amounts?
For example: collumn K thru N amounts should be moved to collumn I thru L and F thru G should move to M thru N.
But it can happen that in some months i get more rows and my macro is not picking up that at all.


example.png
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
This sub does what you said. I hope that it is helpful?

VBA Code:
Sub MoveValues()

    Dim iRowsToClear As Long

    With ThisWorkbook.Worksheets(1)
    
'       Get rid of columns I & J
        .Columns("I:J").Delete
        
'       Put values in columns F & G into M & N
        .Columns("M:N").Value = .Columns("F:G").Value
        
'       This shows how to get the # of rows of data in a column.
        iRowsToClear = .Range("F1").Offset(10000).End(xlUp).Row
        
        .Range("F1").Cells(1).Resize(iRowsToClear, 2).Value = ""
    
    End With

End Sub

Before and after

MoveData.xlsm
FGHIJKLMN
1Total Through 6/25/22Total Through 3/25/22Total Through 4/22/22Total Through 5/20/22
21200134566541234153456740039766400
33604036.81962.37024.51036.822201192.81920
44805382.42616.493661382.429601590.42560
560067283270.511707.51728370019883200
67208073.63924.6140492073.644402385.63840
78409419.24578.716390.52419.251802783.24480
896010764.85232.8187322764.859203180.85120
9108012110.45886.921073.53110.466603578.45760
101200134566541234153456740039766400
11132014801.67195.125756.53801.681404373.67040
127849.2280984147.288804771.27680
138503.330439.54492.896205168.88320
144838.4103605566.48960
1551841110059649600
166361.610240
176759.210880
187156.811520
197554.412160
Sheet1



MoveData.xlsm
FGHIJKLMN
1Total Through 4/22/22Total Through 5/20/22Total Through 6/25/22
23456740039766400120013456
31036.822201192.819203604036.8
41382.429601590.425604805382.4
517283700198832006006728
62073.644402385.638407208073.6
72419.251802783.244808409419.2
82764.859203180.8512096010764.8
93110.466603578.45760108012110.4
103456740039766400120013456
113801.681404373.67040132014801.6
124147.288804771.27680
134492.896205168.88320
144838.4103605566.48960
1551841110059649600
166361.610240
176759.210880
187156.811520
197554.412160
Sheet1
 
Upvote 0

Forum statistics

Threads
1,214,414
Messages
6,119,373
Members
448,888
Latest member
Arle8907

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