Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Where am I going wrong?

Help - trying to Insert Row using CTRL + L (Need to unhide the inserteed row
if that makes sense???)

Sub NewLine()
'
' NewLine Macro
' Macro recorded 31/03/2006 by XXX
'
' Keyboard Shortcut: Ctrl+l
'
ActiveWindow.ScrollRow = 21
ActiveWindow.ScrollRow = 20
ActiveWindow.ScrollRow = 19
ActiveWindow.ScrollRow = 18
ActiveWindow.ScrollRow = 17
ActiveWindow.ScrollRow = 16
ActiveWindow.ScrollRow = 15
ActiveWindow.ScrollRow = 14
ActiveWindow.ScrollRow = 13
ActiveWindow.ScrollRow = 12
ActiveWindow.ScrollRow = 11
ActiveWindow.ScrollRow = 10
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Rows("16:16").Select
Application.CutCopyMode = False
Selection.Copy
Range("A22").Select
Selection.End(xlDown).Select
Selection.Insert Shift:=x2Down
Selection.EntireRow.Hidden = False

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Where am I going wrong?

Sarah,
try:
ActiveCell.EntireRow.Select
Selection.Insert Shift:=xlDown

Ozgur

"Sarah_Lecturer" wrote:

Help - trying to Insert Row using CTRL + L (Need to unhide the inserteed row
if that makes sense???)

Sub NewLine()
'
' NewLine Macro
' Macro recorded 31/03/2006 by XXX
'
' Keyboard Shortcut: Ctrl+l
'
ActiveWindow.ScrollRow = 21
ActiveWindow.ScrollRow = 20
ActiveWindow.ScrollRow = 19
ActiveWindow.ScrollRow = 18
ActiveWindow.ScrollRow = 17
ActiveWindow.ScrollRow = 16
ActiveWindow.ScrollRow = 15
ActiveWindow.ScrollRow = 14
ActiveWindow.ScrollRow = 13
ActiveWindow.ScrollRow = 12
ActiveWindow.ScrollRow = 11
ActiveWindow.ScrollRow = 10
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Rows("16:16").Select
Application.CutCopyMode = False
Selection.Copy
Range("A22").Select
Selection.End(xlDown).Select
Selection.Insert Shift:=x2Down
Selection.EntireRow.Hidden = False

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Where am I going wrong?

You don't need to Select the row.

ActiveCell.EntireRow.Insert shift:=xlShiftDown

It is very rare that you need to Select anything in VBA. Your
code will be considerably faster if you don't select an object,
but instead operate on the object itself.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Ozgur Pars" wrote in
message
...
Sarah,
try:
ActiveCell.EntireRow.Select
Selection.Insert Shift:=xlDown

Ozgur

"Sarah_Lecturer" wrote:

Help - trying to Insert Row using CTRL + L (Need to unhide the
inserteed row
if that makes sense???)

Sub NewLine()
'
' NewLine Macro
' Macro recorded 31/03/2006 by XXX
'
' Keyboard Shortcut: Ctrl+l
'
ActiveWindow.ScrollRow = 21
ActiveWindow.ScrollRow = 20
ActiveWindow.ScrollRow = 19
ActiveWindow.ScrollRow = 18
ActiveWindow.ScrollRow = 17
ActiveWindow.ScrollRow = 16
ActiveWindow.ScrollRow = 15
ActiveWindow.ScrollRow = 14
ActiveWindow.ScrollRow = 13
ActiveWindow.ScrollRow = 12
ActiveWindow.ScrollRow = 11
ActiveWindow.ScrollRow = 10
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 1
Rows("16:16").Select
Application.CutCopyMode = False
Selection.Copy
Range("A22").Select
Selection.End(xlDown).Select
Selection.Insert Shift:=x2Down
Selection.EntireRow.Hidden = False

End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help please what am i doing wrong? Nevyn Excel Discussion (Misc queries) 1 February 9th 10 10:50 PM
Insert Calculated Field (wrong Qty*Price = wrong Amount) Edmund Excel Discussion (Misc queries) 8 October 4th 07 12:13 PM
What am I doing wrong? jewels Excel Worksheet Functions 8 December 8th 05 02:04 PM
What is wrong with this bach Excel Discussion (Misc queries) 0 September 6th 05 09:09 AM
What is wrong with this? A.S.[_2_] Excel Programming 1 August 7th 05 02:25 PM


All times are GMT +1. The time now is 03:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"