I'm converting a lot of VBA code from using absolute references to
named ranges.
Here is an example I'm not sure how to revise.
The original code references rows 2 to 259 in Column A. I have since
named A2:A259 "MyRange" but the original code refers to "iRow = 2 To
259". How can I change this to the equivalent of 'iRow = "MyRange"
Below is the original code:
###
Sheets("NameOfSheet").Select
Cells.Select
Range("A1").Activate ' column that contains the data to be evaluated;
I'll replace "A1" with "MyRange"
Selection.EntireRow.Hidden = False
For iRow = 2 To 259 ' rows that contain the data to be evaluated
' Not sure how to change the above to refer to the range
If IsError(Cells(iRow, 2)) Then ' not sure how to change the
reference to "iRow, 2"
Rows(iRow).Hidden = True
End If
If Not (IsError(Cells(iRow, 2))) Then
If Cells(iRow, 2).Value = 0 Then
Rows(iRow).Hidden = True
End If
End If
Next
###
Thanks for any pointers.
--
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
To post to this group, send email to [email protected]
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!
We reach over 7000 subscribers worldwide and receive many nice notes about the
learning and support from the group.Let friends and co-workers know they can
subscribe to group at http://groups.google.com/group/excel-macros/subscribe