Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete rows
Sub test()
Selection.Rows.EntireRow.Delete End Sub Can you help ammend the above code to stop the row (selection) being deleted if the cell in column A has a number. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete rows
Hi,
Try this but note empty cells are treated as numeric. Post back and tell us what should happen to empty cells If Not (IsNumeric(Cells(ActiveCell.Row, 1))) Then ActiveCell.EntireRow.Delete End If Mike "nc" wrote: Sub test() Selection.Rows.EntireRow.Delete End Sub Can you help ammend the above code to stop the row (selection) being deleted if the cell in column A has a number. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete rows
Option Explicit
sub test2() dim myRng as range dim myCell as range dim DelRng as range 'just in case there's more than one area selected set myrng = selection.areas(1).entirerow.columns(1) 'column A for each mycell in myrng.cells with mycell if application.isnumber(.value) then 'skip it else if delrng is nothing then set delrng = .cells else set delrng = union(delrng, .cells) end if end if end with next mycell if delrng is nothing then 'nothing to delete else delrng.entirerow.delete end if end sub nc wrote: Sub test() Selection.Rows.EntireRow.Delete End Sub Can you help ammend the above code to stop the row (selection) being deleted if the cell in column A has a number. -- Dave Peterson |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete rows
Sub DeleteIfNOTnumber()
Columns(1).SpecialCells(xlCellTypeConstants, 2) _ .EntireRow.Delete 'Select End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "nc" wrote in message ... Sub test() Selection.Rows.EntireRow.Delete End Sub Can you help ammend the above code to stop the row (selection) being deleted if the cell in column A has a number. |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete rows
Do you mean
Sub Mac() For lngRow = Selection.Rows.Count + _ Selection.Row - 1 To Selection.Row Step -1 If Not IsNumeric(Range("A" & lngRow).Text) Then Rows(lngRow).Delete End If Next End Sub If this post helps click Yes --------------- Jacob Skaria "nc" wrote: Sub test() Selection.Rows.EntireRow.Delete End Sub Can you help ammend the above code to stop the row (selection) being deleted if the cell in column A has a number. |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete rows
And yet another variations
With Selection If Not IsNumeric(Cells(.Row, 1)) Then .EntireRow.Delete End With -- If this helps, please click the Yes button. Cheers, Shane Devenshire "nc" wrote: Sub test() Selection.Rows.EntireRow.Delete End Sub Can you help ammend the above code to stop the row (selection) being deleted if the cell in column A has a number. |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete rows
Sorry, didn't work. Deleted any rows.
"Shane Devenshire" wrote: And yet another variations With Selection If Not IsNumeric(Cells(.Row, 1)) Then .EntireRow.Delete End With -- If this helps, please click the Yes button. Cheers, Shane Devenshire "nc" wrote: Sub test() Selection.Rows.EntireRow.Delete End Sub Can you help ammend the above code to stop the row (selection) being deleted if the cell in column A has a number. |
#8
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete rows
sorry, please disregard my prior comment. your macro did not delete the row
with a blank cell in column A. "nc" wrote: Sorry, didn't work. Deleted any rows. "Shane Devenshire" wrote: And yet another variations With Selection If Not IsNumeric(Cells(.Row, 1)) Then .EntireRow.Delete End With -- If this helps, please click the Yes button. Cheers, Shane Devenshire "nc" wrote: Sub test() Selection.Rows.EntireRow.Delete End Sub Can you help ammend the above code to stop the row (selection) being deleted if the cell in column A has a number. |
#9
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete rows
I would like empty cell in column A to be deleted.
"Mike H" wrote: Hi, Try this but note empty cells are treated as numeric. Post back and tell us what should happen to empty cells If Not (IsNumeric(Cells(ActiveCell.Row, 1))) Then ActiveCell.EntireRow.Delete End If Mike "nc" wrote: Sub test() Selection.Rows.EntireRow.Delete End Sub Can you help ammend the above code to stop the row (selection) being deleted if the cell in column A has a number. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to Delete empty rows in excel in b/w rows with values | Excel Worksheet Functions | |||
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows | Excel Worksheet Functions | |||
Q: delete rows | Excel Discussion (Misc queries) | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | Excel Worksheet Functions | |||
delete empty rows between rows with text | Excel Discussion (Misc queries) |