Simple VBA problem

  • Thread starter Thread starter Grant
  • Start date Start date
G

Grant

Hi,

This is my first attempt at writing VBA from a book so excuse the
naivety.

Sub Hidereconciledrows()

Dim i As Integer
i = 2
Do Until IsEmpty(Cells(i, 18))
If Cells(i, 18) = "Reconciles <= 7 day tolerance" Then
Selection.EntireRow.Hidden = True And ActiveCell.Offset(1, 0).Select
ElseIf Cells(i, 18) = "manually reconcile" Then
ActiveCell.Offset(1, 0).Select
End If
i = i + 1
Loop
End Sub

I am performing a reconcilation and if a particular figure matches
another the narritive "Reconciles <= 7 day tolerance" is formularised
to appear in cell(?) column R if the figure does not match then the
narritive "manually reconcile" is formularised to appear.

What I am attempting with VBA is if the cell contains "Reconciles <= 7
day tolerance" the macro will select the entire row and hide the row,
it will then select the next row down, in column R and perform the
same test. When the cell in column R is blank the procedure ends.

Obviosly what I have wriiten above is not working, can someone please
point me in the right direction?

Thanks
Grant
 
instead of this
Selection.EntireRow.Hidden = True And ActiveCell.Offset(1, 0).Select

use
Cells(i, 2).EntireRow.Hidden = True And ActiveCell.Offset(1, 0).Select

- Manges
 
Dim i As Integer
i = 2
Do Until IsEmpty(Cells(i, 18))
With Cells(i, 18)
If .Value = "Reconciles <= 7 day tolerance" Then
.EntireRow.Hidden = True
End If
End With
i = i + 1
Loop
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Back
Top