I don't know what the range is that you are referring to but: Sub Macro2() Range("A1:A3").Select ActiveWorkbook.Names.Add Name:="MyRange", RefersToR1C1:= _ "=Sheet1!R1C1:R3C1" Application.Goto Reference:="MyRange" End Sub
It is the Goto that I think you want Thanks, David On Jul 2, 1:28 pm, Kurt <heislerk...@gmail.com> wrote: > 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 excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> 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