If A1 or A2 is zero, then there can't be a row that is offset by -2. I
suggest to limit it till row 3. So 3-2= 1, which is the first row in the
sheet. But 2-2 and 1-2 do not exist.

Please use this instead

Sub BOLDAboveZero()

    Dim lngLastRow As Long, lngRow As Long

    lngLastRow = Cells(Rows.Count, 1).End(xlUp).Row
    For lngRow = *Application.Max(4,* lngLastRow*)* To *3* Step -1
        With Cells(lngRow, 1)
            If .Value = 0 Then .Offset(-2).EntireRow.Font.Bold = True
        End With
    Next lngRow

End Sub

Regards,

Sam Mathai Chacko (GL)

On Sat, Oct 29, 2011 at 9:58 PM, NOORAIN ANSARI <noorain.ans...@gmail.com>wrote:

> Dear Glenn
>
> Please consider it.....for entire row
>
> *
> Sub test()
> Dim cell As Range
> For Each cell In Sheet1.Range("A1:A" &
> Sheet1.Range("A65536").End(xlUp).Row)
> If cell.Value = 0 Then
> cell.Offset(-2, 0).EntireRow.Font.Bold = True
>
> End If
> Next cell
> End Sub
> *
> On Sat, Oct 29, 2011 at 9:41 PM, NOORAIN ANSARI 
> <noorain.ans...@gmail.com>wrote:
>
>> Dear Glenn,
>>
>> Please try it with Offset.......
>>
>> *Sub test()
>> Dim cell As Range
>> For Each cell In Sheet1.Range("A1:A" &
>> Sheet1.Range("A65536").End(xlUp).Row)
>> If cell.Value = 0 Then
>> cell.Offset(-2, 0).Font.Bold = True
>> End If
>> Next cell
>> End Sub
>> *
>>
>> --
>> Thanks & regards,
>> Noorain Ansari
>>  *http://excelmacroworld.blogspot.com/*<http://excelmacroworld.blogspot.com/>
>> *http://noorain-ansari.blogspot.com/*<http://noorain-ansari.blogspot.com/>
>>  On Sat, Oct 29, 2011 at 4:30 AM, Hayhurst, Glenn A <
>> glenn.a.hayhu...@lmco.com> wrote:
>>
>>>  Hi. I am trying to find cells in Column A with a value of “0” and then
>>> navigating up two rows and making that entire row bold.  It all falls apart
>>> after I try to use Offset.  Where did I go wrong?****
>>>
>>> ** **
>>>
>>> Sub BOLDAboveZero()****
>>>
>>> Dim LR As Long, i As Long****
>>>
>>> LR = Range("A" & Rows.Count).End(xlUp).Row****
>>>
>>> For i = LR To 1 Step -1****
>>>
>>>     With Range("A" & i)****
>>>
>>>         If .Value = 0 Then .ActiveCell.Offset(-2, 0).Select****
>>>
>>> Select.EntireRow.Font.Bold=True
>>>     End With****
>>>
>>> Next i****
>>>
>>> End Sub****
>>>
>>> ** **
>>>
>>> ** **
>>>
>>> --
>>> FORUM RULES (925+ members already BANNED for violation)
>>>
>>> 1) Use concise, accurate thread titles. Poor thread titles, like Please
>>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
>>> not get quick attention or may not be answered.
>>>
>>> 2) Don't post a question in the thread of another member.
>>>
>>> 3) Don't post questions regarding breaking or bypassing any security
>>> measure.
>>>
>>> 4) Acknowledge the responses you receive, good or bad.
>>>
>>> 5) Cross-promotion of, or links to, forums competitive to this forum in
>>> signatures are prohibited.
>>>
>>> NOTE : Don't ever post personal or confidential data in a workbook. Forum
>>> owners and members are not responsible for any loss.
>>>
>>>
>>> ------------------------------------------------------------------------------------------------------
>>> To post to this group, send email to excel-macros@googlegroups.com
>>>
>>
>>
>>
>>
>>
>
>
> --
> Thanks & regards,
> Noorain Ansari
>  *http://excelmacroworld.blogspot.com/*<http://excelmacroworld.blogspot.com/>
> *http://noorain-ansari.blogspot.com/*<http://noorain-ansari.blogspot.com/>
>
>  --
> FORUM RULES (925+ members already BANNED for violation)
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
> not get quick attention or may not be answered.
>
> 2) Don't post a question in the thread of another member.
>
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
>
> 4) Acknowledge the responses you receive, good or bad.
>
> 5) Cross-promotion of, or links to, forums competitive to this forum in
> signatures are prohibited.
>
> NOTE : Don't ever post personal or confidential data in a workbook. Forum
> owners and members are not responsible for any loss.
>
>
> ------------------------------------------------------------------------------------------------------
> To post to this group, send email to excel-macros@googlegroups.com
>



-- 
Sam Mathai Chacko

-- 
FORUM RULES (925+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to