Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
help with macro
My goal is to add a cell between a name i enter and the total so there is
always a blank row. i have this but it only works if cell a4 is changed. A B c 1 Customers 1 George 2 Sam 3 4 Total Private Sub Worksheet_Change(ByVal Target As Range) Dim lastrow As Long, i As Long lastrow = Cells(Rows.Count, "a").End(xlUp).Row If Intersect(Target, Range("A4")) Is Nothing Then Exit Sub Else 'The cell you are monitoring is changed! For i = lastrow To 2 Step -1 If InStr(1, Cells(i, "a"), "Total", vbTextCompare) Then Rows(i).Insert End If Next Application.EnableEvents = True End If End Sub Any help would be appreciated |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor | Excel Programming | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |