Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a piece of mcro code that is giving me grief, but I cannot fin
the error in the logic: The purpose is to loop through the second column until there is no mor data in the column, searching for nulls. If there is a null in a cel from that column, the row needs to be deleted. But it will not detec consecutive null cells, so it is only deleting every second row that want it to. 'Find the end of the range, to set the bounds of th function: Dim areaCount As Integer Columns(1).Select ActiveCell.CurrentRegion.Select areaCount = Selection.Rows.Count Dim counter As Integer 'Loop through from (1, 2) to (end, 2) deleting rows with null in th cells. For counter = 1 To areaCount If Cells(counter, 2).Value = 0 Then Rows(counter).Delete End If Next counter So it should be going: Is (1, 2) null? Nope. Next cell. Is (2,2) null? Nope, Next cell Is (3, 2) null? Yep, Delete the row. Next Cell... If anyone can tell me where I am going wrong here, or just paste working algorithm I would be very grateful. .tehw -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007-macro programming logic for data validation | Excel Discussion (Misc queries) | |||
Find Macro Error | Excel Discussion (Misc queries) | |||
Is there is a 90% chance of a logic error per 150 lines per workbo | Excel Discussion (Misc queries) | |||
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable | Excel Discussion (Misc queries) | |||
macro error "can't find project or library" | Excel Programming |