ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing Marco (https://www.excelbanter.com/excel-programming/413841-changing-marco.html)

JBoyer

Changing Marco
 
I have a marco that does what I want it to except it messes up some of the
other data on my worksheet. I have two marcos, one for inserting and one for
deleting. They are the following:
Sub InsertSemester()
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 DelLastFive()
Dim lr As Long, x As Long
lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
x = lr - 4
ActiveSheet.Rows(x & ":" & lr).Delete
End Sub


JBoyer

Changing Marco
 
Sorry this was posted by accident. It can be ignored I have a different post
with the complete question

"JBoyer" wrote:

I have a marco that does what I want it to except it messes up some of the
other data on my worksheet. I have two marcos, one for inserting and one for
deleting. They are the following:
Sub InsertSemester()
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 DelLastFive()
Dim lr As Long, x As Long
lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
x = lr - 4
ActiveSheet.Rows(x & ":" & lr).Delete
End Sub



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com