I have several dynamic named ranges that span multiple worksheets. The ranges are named Sheet1Data, Sheet2Data ... up to Sheet4Data.
I need to create a macro that applies a bottom border to the last row in each range. I've taken some code that loops through the *cells* in each range (Dim c As Range), and tried to adapt it to look only at the last row. But I need some help with the For Each syntax. Here's what I have so far: Public Sub AddBorder() Dim i As Integer Dim c As Range Dim LastRow As Long ' Cycle through each Named Range For i = 1 To 4 ' Cycle through each range For Each c In Range("Sheet" & i & "Data") ' Identify the last row, and create a LastRow variable LastRow = Range("Sheet" & i & "Data").End(xlUp).Row ' Apply a bottom border to the last row in the range Range("Comp" & i & "Measures" & LastRow).Borders(xlEdgeBottom).LineStyle = xlContinous Next c Next i End Sub ### Thanks for any advice. -- ---------------------------------------------------------------------------------- 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 <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts