insert a line

  • Thread starter Thread starter PeCoNe
  • Start date Start date
P

PeCoNe

I use W7 64 bit and excel 2010 NL
My sheet is over 800 lines.
Column B is date and column C is time
Now i use the next macro:

Sub InsertNewLine()
'
' InsertNewLine Macro
' Macro recorded 2006-09-22 by Peter Maljers
'
' Keyboard Shortcut: Ctrl+Shift+N
'

Worksheets("Journaal+Grootboek").Activate
ActiveSheet.Protect UserInterfaceOnly:=True
Rows("9:9").Select
Selection.Copy
Rows("10:10").Select
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
Rows("8:8").Select
Selection.Copy
Rows("9:9").Select
ActiveSheet.Paste
Range("B9").Select
Application.CutCopyMode = False
End Sub

Inserting a row before row 9 takes longer every time.
How can i speedup that process?

Thanks Peter
 
I use W7 64 bit and excel 2010 NL
My sheet is over 800 lines.
Column B is date and column C is time
Now i use the next macro:

Sub InsertNewLine()
'
' InsertNewLine Macro
' Macro recorded 2006-09-22 by Peter Maljers
'
' Keyboard Shortcut: Ctrl+Shift+N
'

Worksheets("Journaal+Grootboek").Activate
ActiveSheet.Protect UserInterfaceOnly:=True
Rows("9:9").Select
Selection.Copy
Rows("10:10").Select
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
Rows("8:8").Select
Selection.Copy
Rows("9:9").Select
ActiveSheet.Paste
Range("B9").Select
Application.CutCopyMode = False
End Sub

Inserting a row before row 9 takes longer every time.
How can i speedup that process?

Thanks Peter

Hi Peter,

Try:

'==========>>
Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range

Set WB = ThisWorkbook
Set SH = WB.Worksheets("Journaal+Grootboek")
Set Rng = SH.Rows("8:8")

With Rng
.Copy
.Insert shift:=xlDown
End With
Application.CutCopyMode = False
End Sub
'<<=============

===
Regards,
Norman
 
Back
Top