Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everyone,
Can someone tell me what is wrong with this syntax? To me it looks fine but it doesn't delete the row within the selection it deleted everything in the spreadsheet. What I have done is: * a range of cells (G19:G36) is named as range1 * another range (Xn:Xn) is named as rangen towards the end of the sub it selects range1 with the following code.... Range("range1").Select Call delete_unusedrows the syntax for delete_unusedrows is ----------------------------------------------------------------------------------------------------- Sub delete_unusedrows() On Error Resume Next For Each cell In Selection If cell.Offset(0, -6) = "R" Or cell.Offset(0, -6) = "E" Then If cell = 0 Then Cells.Rows.EntireRow.Delete = True End If End If Next cell End Sub ----------------------------------------------------------------------------------------------------- One of the problems that I came across is that I am selecting the "cell" where I'm verifying that the value = 0. I did a macro to test if the cell = 0 worked and it appeared to have worked. Thus......... Why is it that when it gets to range1 it deletes everything rather than what is in that selection? I'm stumped...... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro to delete hidden or unused rows | Excel Programming | |||
How can i delete unused row and columns ??? | Excel Discussion (Misc queries) | |||
Delete Unused (4000) Rows | Excel Programming | |||
how to delete unused footer dialogs in excell | Excel Worksheet Functions | |||
VB Code to Delete Unused Rows | Excel Programming |