Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
deleting "0" rows
Hello,
I have this code and it works perfectly for me (see code below). I want to simplify it so it dosent ask me for which column to delete "0" from. This column is always J in my worksheet. Can't figure it out though, whats the right code? Thanks... Sub deletezeros() colabel = InputBox("column label to delete zeros (ex. A, B, C...)") lrow = Cells(Rows.Count, colabel).End(xlUp).Row For i = lrow To 1 Step -1 If Cells(i, colabel) = 0 Then Rows(i).Delete Next i End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
deleting "0" rows
Sub deletezeros()
colabel = 10 lrow = Cells(Rows.Count, colabel).End(xlUp).Row For i = lrow To 1 Step -1 If Cells(i, colabel) = 0 Then Rows(i).Delete Next i End Sub -- Regards, Tom Ogilvy "steven" wrote: Hello, I have this code and it works perfectly for me (see code below). I want to simplify it so it dosent ask me for which column to delete "0" from. This column is always J in my worksheet. Can't figure it out though, whats the right code? Thanks... Sub deletezeros() colabel = InputBox("column label to delete zeros (ex. A, B, C...)") lrow = Cells(Rows.Count, colabel).End(xlUp).Row For i = lrow To 1 Step -1 If Cells(i, colabel) = 0 Then Rows(i).Delete Next i End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
deleting "0" rows
change
colabel = InputBox("column label to delete zeros (ex. A, B, C...)") to colabel = worksheet.columns("j") (not sure if syntax is right.............untested). susan On Feb 20, 11:29 am, steven wrote: Hello, I have this code and it works perfectly for me (see code below). I want to simplify it so it dosent ask me for which column to delete "0" from. This column is always J in my worksheet. Can't figure it out though, whats the right code? Thanks... Sub deletezeros() colabel = InputBox("column label to delete zeros (ex. A, B, C...)") lrow = Cells(Rows.Count, colabel).End(xlUp).Row For i = lrow To 1 Step -1 If Cells(i, colabel) = 0 Then Rows(i).Delete Next i End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
deleting "0" rows
Sub deletezeros()
lrow = Cells(Rows.Count, "J").End(xlUp).Row For i = lrow To 1 Step -1 If Cells(i, "J").Value = 0 Then Rows(i).Delete Next i End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "steven" wrote in message ... Hello, I have this code and it works perfectly for me (see code below). I want to simplify it so it dosent ask me for which column to delete "0" from. This column is always J in my worksheet. Can't figure it out though, whats the right code? Thanks... Sub deletezeros() colabel = InputBox("column label to delete zeros (ex. A, B, C...)") lrow = Cells(Rows.Count, colabel).End(xlUp).Row For i = lrow To 1 Step -1 If Cells(i, colabel) = 0 Then Rows(i).Delete Next i End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
Deleting groups of continuous rows where col K = "x" | Excel Programming | |||
Deleting "duplicate" rows | Excel Discussion (Misc queries) | |||
Deleting Rows with Sum of "0" in 4 columns | Excel Programming |