Automatic insert / delete rows and accompanying formulas + formats

cverbog

New Member
Joined
Feb 12, 2010
Messages
1
Hello all,

I have a document that I frequently use for making calculations for quotations. I always use the same formulas in each line for this document with different operations in the columns.

To have an overview, I have split these enumerations into phases and subphases. To avoid errors, I wrote a macro that copies these formulas from a hidden sheet. Also the lay-out is copied from this document.

Because of my pour programming skills, this macro is pretty sluggisch.

The document in general is OK for me, but now some colleagues of mine also want to use this program. It was never intended for someone else to use and isn't fool proof.

Can someone help me to make this more reliable?

This is for example the macro I use for inserting a new row:
Sub Lijn_Invoegen()
'
'
Application.ScreenUpdating = False
Application.CutCopyMode = False

If Not ActiveCell.Borders(xlEdgeBottom).LineStyle = xlLineStyleNone Then MsgBox "U kan hier geen lijnen invoegen. Gelieve op een blauw vakje te gaan staan"
If Not ActiveCell.Borders(xlEdgeBottom).LineStyle = xlLineStyleNone Then GoTo Handlecancel
Sheets("Voorbereidingsblad").Unprotect
Dim Rng
Rng = InputBox("Geef het aantal benodigde rijen in.")
On Error GoTo Handlecancel
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(Rng - 1, 0)).Select
Selection.EntireRow.Insert
ActiveCell.Rows("1:1").EntireRow.Select
ActiveCell.Offset(0, 9).Range("A1").Select
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(Rng - 1, 6)).Select
Sheets("Basis").Visible = True
Sheets("Basis").Select
Range("A1").Select
ActiveCell.Range("j10:P10").Select
Selection.Copy
Sheets("Voorbereidingsblad").Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveCell.Offset(0, -7).Range("A1").Select
Application.CutCopyMode = False
ActiveCell.Offset(Rng, 0).Range("A1").Select
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(0, 6)).Select
Selection.Copy
Range(ActiveCell.Offset(-1, 0), ActiveCell.Offset(-Rng, 6)).Select
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveCell.Select
Application.CutCopyMode = False

Handlecancel:
Sheets("Basis").Visible = False
If Err = 13 Then
MsgBox "U heeft geanulleerd."
End If
'Sheets("Voorbereidingsblad").Protect
End Sub

PS: How can I show the XLS file?
 
Last edited:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,214,576
Messages
6,120,354
Members
448,956
Latest member
Adamsxl

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