PDA

View Full Version : Sleeper: Tempremental coding?



cmpgeek
03-11-2005, 01:31 PM
i was using the code below to remove "dead space" within an Excel workbook. I had used the same code on two different sheets... ( i opened the VBE and had pasted on both sheets in case that is significant later... )

shortly after i saved the document something caused a power surge and the computer flickered and then shut down... during the next minute or so it tried to reboot itself three or four times and each time the power would flicker or surge... (i am still waiting to hear what would cause the hospital's mainframe power source to do that to that extent... should be interesting...)

once the power seemed to be back to normal i turned the PC back on and got some (different) blue screen of death that started out with "if this is the first time you have received this screen - reboot your computer, if not....." i rebooted and it did some diskscan and i was able to catch a couple lines of text that said that it was deleteing a corrupted file or something... (i didnt catch all of it because it was flying through the lines)...

anyway, i got back into the workbook and exported the last two versions of the report i am working on into two additional spreadsheets. now - for some reason - not only is the code not doing what it was before; it is now deleteing rows that DO have text in them!!! (although it is doing this one row at a time for each time you hit the PLAY button within the VBE)...

does anyone have ANY idea what caused this? i dont know if the power thing could or not - my first guess is no; but it is the only thing i can think of that happened... i was in the middle of working on the workbook when the power went out so it is not like i might have changed something within the coding and forgot or anything... i am at a complete loss...

(yes i know that is not unusual for me, but i am pleading for understanding here so bear with me LOL... :bug: :bug: :bug: )

here is the coding:


Sub DellTime()
Dim myRng As Range
Application.ScreenUpdating = False
On Error Resume Next
With Sheets(1)
.AutoFilterMode = False
Set myRng = Range(.Cells(2, 1), .Cells(65336, 1).End(xlUp))
myRng.AutoFilter Field:=1, Criteria1:="="
myRng.SpecialCells(xlVisible).EntireRow.Delete
.AutoFilterMode = False
With .Range("a1")
If Not CBool(Len(.Value)) Then .EntireRow.Delete
End With
End With
Set myRng = Nothing
Application.ScreenUpdating = True
End Sub



thank you for any suggestions yall may have...

BlueCactus
03-11-2005, 01:36 PM
Don't know, but it also does not surprise me. I have on occasion had to restart Excel (Win/Mac), reboot machine (Win) and reinstall Office (Win) to fix VBA inconsistencies that creep in from time to time. Drives you nuts because the code makes sense, but either gives an error or does something unforeseen.

cmpgeek
03-11-2005, 01:58 PM
i started over with a brand new workbook... i re-exported the report results again... i pasted the code within each sheets VBE "page" and tried to run each one...

it worked on the first one but not the others...

it just keeps getting weirder and weirder...

guess ill go start deleting lines... <grumbles>

thanks for your insight - at least i know i can put off the psych ward for one more week... lol

if anyone else thinkgs of anything - i'd love to hear what you think may be wrong...