macro adjust to use =offset?

d0wnt0wn

Well-known Member
Joined
Oct 28, 2002
Messages
771
hey guys i have this macro ... the 2nd part names ranges based on a list...currently it refers to a4:a19, b4:b19 etc... is thre anyway to adjust it so it uses the =offset function instead???

Sub NameThoseRanges()

Dim nm As Name
Dim oneCell As Range
For Each nm In ActiveWorkbook.Names
If nm.Name <> "WsList" And nm.Name <> "TeamNames" And nm.Name <> "PrintArea" And nm.Name <> "teams" Then
nm.Delete
End If
Next

With Worksheets("Score sheet").Range("Dn1:Dn17")
For Each oneCell In .Cells
On Error Resume Next
If oneCell.Text <> vbNullString Then
.Offset(2, oneCell.Row).Resize(17, 1).Name = oneCell.Text
End If
On Error GoTo 0
Next oneCell
End With

End Sub

cheers
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

d0wnt0wn

Well-known Member
Joined
Oct 28, 2002
Messages
771
bump



hey guys i have this macro ... the 2nd part names ranges based on a list...currently it refers to a4:a19, b4:b19 etc... is thre anyway to adjust it so it uses the =offset function instead???

Sub NameThoseRanges()

Dim nm As Name
Dim oneCell As Range
For Each nm In ActiveWorkbook.Names
If nm.Name <> "WsList" And nm.Name <> "TeamNames" And nm.Name <> "PrintArea" And nm.Name <> "teams" Then
nm.Delete
End If
Next

With Worksheets("Score sheet").Range("Dn1:Dn17")
For Each oneCell In .Cells
On Error Resume Next
If oneCell.Text <> vbNullString Then
.Offset(2, oneCell.Row).Resize(17, 1).Name = oneCell.Text
End If
On Error GoTo 0
Next oneCell
End With

End Sub

cheers
 
Upvote 0

Forum statistics

Threads
1,195,990
Messages
6,012,721
Members
441,722
Latest member
tpaman1975

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
Top