dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,375
- Office Version
- 365
- 2016
- Platform
- Windows
I have a spreadsheet for calculating costs of services for someone.
Row 8 to row 28 contain
The ability to copy rows is needed as there will be different ratios that apply to the different areas that are copied.
In addition,
The totals are not working yet but I am just trying to get the formatting working first. Here is the code that makes the range be copied once and everything looks like it should but if I press the button again, I need it to be replicated below it in the same format again. Can someone help me please?
Thanks,
Dave
Row 8 to row 28 contain
- Dates
- Times
- Type of work
- An area to enter expenses
- Rows containing various totals
The ability to copy rows is needed as there will be different ratios that apply to the different areas that are copied.
In addition,
- I have a total field in H29 that sums the totals in H20 to H28
- H30 is a GST field
- H31 is a total for this period
- H32 is a grand total
The totals are not working yet but I am just trying to get the formatting working first. Here is the code that makes the range be copied once and everything looks like it should but if I press the button again, I need it to be replicated below it in the same format again. Can someone help me please?
VBA Code:
Sub AddRows()
Dim Total As Range
With ThisWorkbook.Worksheets("ACA_Quoting")
.Range("29:31").EntireRow.Insert
'.Rows(29).Insert Shift:=xlShiftDown 'Inserts a row below the current table to create a buffer zone between the 2 tables.
.Range("F32:H35").Copy .Range("F51")
.Range("A8:I28").Copy .Range("A30") 'Pastes a copy of the table below current table between the bottom of the table and the totals
'.Range("F30:H32").Offset(2, 0).Select 'This is the range of the totals that need to be moved down so the additional table can be pasted in
'.Range("C7").Insert Shift:=xlDown
.Shapes.Range(Array("cmdAddRatio")).Select
.Shapes("cmdAddRatio").IncrementTop 340
.Shapes.Range(Array("cmdGsign")).Select
.Shapes("cmdGsign").IncrementTop 340
.Shapes.Range(Array("cmdNoSign")).Select
.Shapes("cmdNoSign").IncrementTop 340
.Shapes.Range(Array("cmdSaveToPdf")).Select
.Shapes("cmdSaveToPdf").IncrementTop 340
.Shapes.Range(Array("cmdCustomSign")).Select
.Shapes("cmdCustomSign").IncrementTop 340
.Shapes.Range(Array("textbox4")).Select
.Shapes("textbox4").IncrementTop 340
.Range("29:31").EntireRow.Insert
End With
End Sub
Thanks,
Dave