OleMiss2010
Member
Essentially I have a name cell in every tab of a workbook. I am trying to pull those names onto the summary tab and then Name the list of names so that some equations being referenced by the Name will be correctly filled. I know there has to be a less complicated code than what I've written (which doesn't work anyway) to accomplish this goal. My code is below and I think it pretty clearly shows what I'm trying to do, I'm just not sure what needs to be fixed.
[pre]
[/pre]
[pre]
Code:
Sub Relationship_List()
If Cells <> Range("L1") Then
If ActiveCell = Range("L1") Then
For Each Cell In ThisWorkbook.Sheets("Summary").Columns("L:L")
Cell.Select
For Each Worksheet In ThisWorkbook.Worksheets
If Worksheet.Name <> "Summary" Then
Cells = Worksheet.Range("C5")
End If
Next Worksheet
Next Cell
End If
End If
Sheets("Summary").Columns("L:L").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, Skipblanks _
:=False, Transpose:=False
Selection.Replace What:="0", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Add Key:=Range("L:L") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Summary").Sort
.SetRange Range("L:L")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Names("SheetList").Delete
With ActiveWorkbook.Worksheets("Summary").Range("L:L")
If Cells <> Range("L1") Then
If Cells <> "" And Cells <> "<>" Then
.Select
ActiveWorkbook.Names.Add Name:="SheetList", RefersToR1C1:=Selection
End If
End If
End With
End Sub