Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I want to revise the macro to state if column K is "" and column N is ""
delete the row and end else if K = "" and N is < "" continue. I do not want to copy N if it is blank......just delete the row. Please help. Thanks. Dim nSheetRow As Long 'Current row being looked at Dim bKeepGoing As Boolean 'Used to determine when to stop bKeepGoing = True nSheetRow = 6 Do While bKeepGoing nSheetRow = nSheetRow + 1 sRange = "K" & nSheetRow Range(sRange).Select If Trim(Selection.Value) = "" Then I want to say if K = "" and N = "" sRange = "N" & nSheetRow end loop...otherwise continue Range(sRange).Select Selection.Copy nSheetRow = nSheetRow - 1 sRange = "N" & nSheetRow Range(sRange).Select ActiveSheet.Paste nSheetRow = nSheetRow + 1 sRange = "N" & nSheetRow Range(sRange).Select Application.CutCopyMode = False Selection.EntireRow.Delete nSheetRow = nSheetRow - 1 End If sRange = "A" & (nSheetRow + 1) Range(sRange).Select If Selection.Value = "" Then bKeepGoing = False End If Loop Range("A7").Select Rows("6:70").Select Range(Selection, Selection.End(xlDown)).Select Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(3, 11), _ Replace:=True, PageBreaks:=False, SummaryBelowData:=True Range("A1").Select End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Editing a macro | Excel Discussion (Misc queries) | |||
Editing a Macro | Excel Discussion (Misc queries) | |||
Editing Macro | Excel Discussion (Misc queries) | |||
Editing a simple macro | Excel Worksheet Functions | |||
in cell editing macro | Excel Discussion (Misc queries) |