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
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 ANSA
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://excelmacrowo
@googlegroups.com
Subject: $$Excel-Macros$$ Find a value in column A and make row above bold
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
TRy this
Sam
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 w
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