Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Changing Marco

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
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
Changing Marco JBoyer Excel Programming 1 July 10th 08 04:52 PM
Marco Puzzled Excel Discussion (Misc queries) 3 July 30th 07 05:09 PM
Changing Cell Backround from Marco davep1553 Excel Programming 1 January 22nd 06 08:27 AM
Marco Loi New Users to Excel 4 December 7th 04 08:52 PM
Marco to run every day at 12 bris Excel Programming 6 March 3rd 04 01:07 PM


All times are GMT +1. The time now is 05:50 PM.

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

About Us

"It's about Microsoft Excel"