Automatic insert / delete rows and accompanying formulas + formats


New Member
Feb 12, 2010
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
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
ActiveCell.Offset(0, 9).Range("A1").Select
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(Rng - 1, 6)).Select
Sheets("Basis").Visible = True
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
Range(ActiveCell.Offset(-1, 0), ActiveCell.Offset(-Rng, 6)).Select
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False

Sheets("Basis").Visible = False
If Err = 13 Then
MsgBox "U heeft geanulleerd."
End If
End Sub

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

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...