PC Review


Reply
Thread Tools Rate Thread

Changing Marco

 
 
JBoyer
Guest
Posts: n/a
 
      10th Jul 2008
I currently have two marcos that I would like to slightly change. They were
originally what I wanted, until I realized that by inserting and deleting
rows they were messing up other data on my sheet. Here are the two I have:

Sub InsertFiveRows()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
v = Rows(LastRow - 1).Formula
Cells(LastRow - 1, "A").Resize(5, 1).EntireRow.Insert
Rows(LastRow - 1) = v
Rows(LastRow + 4).ClearContents
Range("AU2:BG6").Copy Cells(LastRow, "A")
End Sub

Sub DeleteFiveRows()
Dim lr As Long, x As Long
lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
x = lr - 5
ActiveSheet.Rows(x & ":" & lr -1).Delete
End Sub

Can you help me so that I can shift the cells up or down rather than
inserting and deleting cells.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Marco JBoyer Microsoft Excel Programming 1 10th Jul 2008 04:52 PM
Marco =?Utf-8?B?UHV6emxlZA==?= Microsoft Excel Misc 3 30th Jul 2007 05:09 PM
Changing Cell Backround from Marco davep1553 Microsoft Excel Programming 1 22nd Jan 2006 08:27 AM
Is there any Excel marco can get key input while the marco is running? SARA Microsoft Excel Programming 7 9th Mar 2004 05:27 AM
Marco to run every day at 12 bris Microsoft Excel Programming 6 3rd Mar 2004 01:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:01 PM.