Editing Named Range

Coop913

New Member
Joined
Sep 14, 2011
Messages
5
On a worksheet named "Hidden", I have the following code, which takes several three-column groups and sorts them. Another worksheet then grabs the results.

Private Sub Worksheet_Activate()

With ActiveSheet
With .Range("Hits")
.Sort key1:="Hits", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("HR")
.Sort key1:="HR", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("Doubles")
.Sort key1:="2B", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("Triples")
.Sort key1:="3B", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("RBIs")
.Sort key1:="RBIs", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("Runs")
.Sort key1:="Runs", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("Walks")
.Sort key1:="BB", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("SO")
.Sort key1:="SO", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("SB")
.Sort key1:="SB", order1:=xlDescending, key2:="CS", order1:=xlAscending, _
Header:=xlYes
End With
With .Range("Wins")
.Sort key1:="W", order1:=xlDescending, key2:="L", order1:=xlAscending, _
Header:=xlYes
End With
With .Range("Saves")
.Sort key1:="S", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("IP")
.Sort key1:="IP", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("SOP")
.Sort key1:="SO", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("Games")
.Sort key1:="G", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("CG")
.Sort key1:="CG", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("SHO")
.Sort key1:="SHO", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("AVG")
.Sort key1:="AVG", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("OBP")
.Sort key1:="OBP", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("SLG")
.Sort key1:="SLG", order1:=xlDescending, _
Header:=xlYes
End With
With .Range("ERA")
.Sort key1:="ERA", order1:=xlAscending, _
Header:=xlYes
End With
End With
End Sub

My problem is that I want to extend the range to include more rows at the bottom of these named ranges. I don't know how to do that, nor even how to find the code (whatever) that a friend used to define these ranges a couple of years ago.

Can anyone please help me with this?

Thanks in advance,
Jack
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
You haven't really described how your data is laid out (all on the same sheet or on different sheets), but you can re-define your named range to include the new data.

Here is one method that uses Current Region that selects all contiguous cells from a given starting cell.
Code:
ActiveWorkbook.Names.Add Name:="MyRange", RefersTo:=Range("A1").CurrentRegion

So starting in cell A1, it will select all surrounding cells up to the first blank cell/row combination.

If this does not work for you, please describe your data structure and needs in more detail.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top