View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JBoyer JBoyer is offline
external usenet poster
 
Posts: 72
Default Can someone help me with this marco

Well this is the original marco,

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

But in addition to that I am trying to copy cells BI2 through BO26 and paste
them out of the way in what I said would be BI200. Then since 5 rows are
being deleted the cells I just copied would be moved down five rows. So I
would like to copy BI195:BJ219 and paste it in y2 and bi2. I would also like
to copy bm195:bo219 and paste it in ak2 and bm2. then after that cells
BI195:BO219 can be deleted.

"JLGWhiz" wrote:

Perhaps if you explained what you are trying to do, someone could help. The
code you posted is too ambiguous to tell exactly what you expect as a result.

"JBoyer" wrote:

Actually I meant something like this, which still isn't right but more of
what I want.

Sub DeleteSemester()
Dim lr As Long, x As Long
lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
x = lr - 5
Range("BI2:BO26").Copy Cells(200, BI)
ActiveSheet.Rows(x & ":" & lr - 1).Delete
Range("BI195:BJ219").Copy Cells(2, Y)
Range("BI195:BJ219").Copy Cells(2, BI)
Range("BI195:BJ219").Delete
Range("BM195:BO219").Copy Cells(2, AK)
Range("BM195:BO219").Copy Cells(2, BM)
Range("BM195:BO219").Delete
End Sub

"JBoyer" wrote:

Not familiar with marcos can someone tell me what I did wrong. Or even better
and help make it right.

Sub DeleteSemester()
Dim lr As Long, x As Long
lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
x = lr - 5
Range("BI2:BO26").Copy Cells(200, BI)
ActiveSheet.Rows(x & ":" & lr - 1).Delete
Range("BI195:BJ195").Copy Cells(2, Y)
Range("BI195:BJ195").Copy Cells(2, BI)
Range("BI195:BJ195").Delete
Range("BM195:BO195").Copy Cells(2, AK)
Range("BM195:BO195").Copy Cells(2, BM)
Range("BM195:BO195").Delete
End Sub