#1   Report Post  
Posted to microsoft.public.excel.misc
pm pm is offline
external usenet poster
 
Posts: 122
Default Editing a macro

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





  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Editing a macro

something like this
sub deleterowsif()
for i= cells(rows.count,"k").end(xlup).row to 2 step-1
if cells(i,"k")="" and cells(i,"n")="" then rows(i).delete
next i
end sub
--
Don Guillett
SalesAid Software

"pm" wrote in message
...
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






  #3   Report Post  
Posted to microsoft.public.excel.misc
pm pm is offline
external usenet poster
 
Posts: 122
Default Editing a macro

Don,
Can't get this to work...any other suggestions?

"Don Guillett" wrote:

something like this
sub deleterowsif()
for i= cells(rows.count,"k").end(xlup).row to 2 step-1
if cells(i,"k")="" and cells(i,"n")="" then rows(i).delete
next i
end sub
--
Don Guillett
SalesAid Software

"pm" wrote in message
...
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







  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Editing a macro

"Can't get this to work " is not terribly descriptive. copy some
representative rows here or send me your workbook.

--
Don Guillett
SalesAid Software

"pm" wrote in message
...
Don,
...any other suggestions?

"Don Guillett" wrote:

something like this
sub deleterowsif()
for i= cells(rows.count,"k").end(xlup).row to 2 step-1
if cells(i,"k")="" and cells(i,"n")="" then rows(i).delete
next i
end sub
--
Don Guillett
SalesAid Software

"pm" wrote in message
...
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








  #5   Report Post  
Posted to microsoft.public.excel.misc
pm pm is offline
external usenet poster
 
Posts: 122
Default Editing a macro

Hi Don,

Would you please reply if you get this message? I'm not receiving todays
discussions?????!!!!
thanks.

"Don Guillett" wrote:

something like this
sub deleterowsif()
for i= cells(rows.count,"k").end(xlup).row to 2 step-1
if cells(i,"k")="" and cells(i,"n")="" then rows(i).delete
next i
end sub
--
Don Guillett
SalesAid Software

"pm" wrote in message
...
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









  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Editing a macro

got it


--
Don Guillett
SalesAid Software

"pm" wrote in message
...
Hi Don,

Would you please reply if you get this message? I'm not receiving todays
discussions?????!!!!
thanks.

"Don Guillett" wrote:

something like this
sub deleterowsif()
for i= cells(rows.count,"k").end(xlup).row to 2 step-1
if cells(i,"k")="" and cells(i,"n")="" then rows(i).delete
next i
end sub
--
Don Guillett
SalesAid Software

"pm" wrote in message
...
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








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
Editing a macro Dtmos01 Excel Discussion (Misc queries) 6 April 3rd 07 06:36 PM
Editing a Macro ChuckW Excel Discussion (Misc queries) 1 December 12th 06 07:45 PM
Editing Macro heitorfjr Excel Discussion (Misc queries) 1 January 15th 06 07:02 PM
Editing a simple macro Connie Martin Excel Worksheet Functions 5 November 29th 05 09:19 PM
in cell editing macro ynissel Excel Discussion (Misc queries) 2 July 27th 05 07:28 PM


All times are GMT +1. The time now is 09:44 AM.

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"