Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi: I have an extremely large wb with hundreds of ws. All ws' have the same format. I need to evaluate all cells in range F25:R29 and if the value of the cell has a number 0 then go to the next. If the value is blank then insert a zero. I have been using the code below but for for some reason, after 20 ws' or so, it starts writting zeros in other cells. Any help is welcome. Sub makeZero() For Each SH In ActiveWorkbook.Worksheets SH.Activate Range("F21").Activate For i = 1 To 13 If ActiveCell = "" Then ActiveCell = 0 ActiveCell.Offset(0, 1).Select ElseIf ActiveCell = "N/A" Then ActiveCell = 0 ActiveCell.Offset(0, 1).Select ElseIf ActiveCell < 0 Then ActiveCell.Offset(0, 1).Select ElseIf ActiveCell = 0 Then ActiveCell.Offset(0, 1).Select End If Next i ''''''''''''''''''''' Range("F25").Activate For i = 1 To 13 If ActiveCell = "" Then ActiveCell = 0 ActiveCell.Offset(1, 0).Select ElseIf ActiveCell = "N/A" Then ActiveCell = 0 ActiveCell.Offset(0, 1).Select ElseIf ActiveCell < 0 Then ActiveCell.Offset(1, 0).Select ElseIf ActiveCell = 0 Then ActiveCell.Offset(1, 0).Select End If If ActiveCell = "" Then ActiveCell = 0 ActiveCell.Offset(1, 0).Select ElseIf ActiveCell = "N/A" Then ActiveCell = 0 ActiveCell.Offset(0, 1).Select ElseIf ActiveCell < 0 Then ActiveCell.Offset(1, 0).Select ElseIf ActiveCell = 0 Then ActiveCell.Offset(1, 0).Select End If If ActiveCell = "N/A" Then ActiveCell = 0 ActiveCell.Offset(1, 0).Select ElseIf ActiveCell = "" Then ActiveCell = 0 ActiveCell.Offset(0, 1).Select ElseIf ActiveCell < 0 Then ActiveCell.Offset(1, 0).Select ElseIf ActiveCell = 0 Then ActiveCell.Offset(1, 0).Select End If If ActiveCell = "" Then ActiveCell = 0 ActiveCell.Offset(1, 0).Select ElseIf ActiveCell = "N/A" Then ActiveCell = 0 ActiveCell.Offset(0, 1).Select ElseIf ActiveCell < 0 Then ActiveCell.Offset(1, 0).Select ElseIf ActiveCell = 0 Then ActiveCell.Offset(1, 0).Select End If If ActiveCell = "" Then ActiveCell = 0 ActiveCell.Offset(-4, 1).Select ElseIf ActiveCell = "N/A" Then ActiveCell = 0 ActiveCell.Offset(0, 1).Select ElseIf ActiveCell < 0 Then ActiveCell.Offset(-4, 1).Select ElseIf ActiveCell = 0 Then ActiveCell.Offset(-4, 1).Select End If Next i Next End Sub ![]() ![]() -- halem2 ------------------------------------------------------------------------ halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930 View this thread: http://www.excelforum.com/showthread...hreadid=557861 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HOWTO: What is the formula to have evaluate a range of value | Excel Discussion (Misc queries) | |||
Formula to Evaluate Range and Sum Different Column | Excel Discussion (Misc queries) | |||
How to write vba to evaluate the text font and size on an active cell range? | Excel Programming | |||
want sumif function's range to evaluate 2 columns | Excel Worksheet Functions | |||
HOW to Evaluate a range with IF ? | Excel Discussion (Misc queries) |