ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple VBA problem (https://www.excelbanter.com/excel-programming/316134-simple-vba-problem.html)

Grant[_7_]

Simple VBA problem
 
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

mangesh_yadav[_174_]

Simple VBA problem
 

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

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=27649


Bob Phillips[_6_]

Simple VBA problem
 
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)


"Grant" wrote in message
m...
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




Grant[_7_]

Simple VBA problem
 
Thankyou for your reply, it worked a treat!!

Grant

"Bob Phillips" wrote in message ...
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)


"Grant" wrote in message
m...
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



All times are GMT +1. The time now is 03:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com