insert a line


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
 
Ad

Advertisements

N

Norman Jones

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top