coyotenorth
New Member
- Joined
- Nov 24, 2014
- Messages
- 23
- Office Version
- 2010
- Platform
- Windows
I am working with a recipe book and having problem with code for returning value to index page. My index page have this code:
"Private Sub Worksheet_Activate()
Dim wSheet As Worksheet
Dim M As Long
M = 3
With Me
.Columns(1).ClearContents
.Cells(1, 1) = ""
.Cells(1, 1).Name = "Index"
End With
For Each wSheet In Worksheets
If wSheet.Name <> Me.Name Then
M = M + 1
With wSheet
.Range("H1").Name = "Start" & wSheet.Index
.Hyperlinks.Add Anchor:=.Range("x1"), Address:="", SubAddress:="Index", TextToDisplay:="Tilbake til oppskrifter"
End With
Me.Hyperlinks.Add Anchor:=Me.Cells(M, 1), Address:="", SubAddress:="Start" & wSheet.Index, TextToDisplay:=wSheet.Name
End If
Next wSheet
Columns("A:A").Select
With Selection.Font
.Size = 16
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = False
.TintAndShade = 0
End With
With Selection.Font
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
End With
Range("A4").Select
ActiveWorkbook.Worksheets("Recipe").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Recipe").Sort.SortFields.Add Key:=Range("A4") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Recipe").Sort
.SetRange Range("A4:A120")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.AutoFilter
End Sub"
This list all the worksheets, set hyperlink to the sheet and sort them.
What i want to do is to is to get a value from cell B2 in that sheet returned to collum B in index sheet locked to the sheet name.
This could be in VBA code to the index sheet, a macro or formula.
ANY HELP WILL DO!
(Have example file but dont know how to upload it)
"Private Sub Worksheet_Activate()
Dim wSheet As Worksheet
Dim M As Long
M = 3
With Me
.Columns(1).ClearContents
.Cells(1, 1) = ""
.Cells(1, 1).Name = "Index"
End With
For Each wSheet In Worksheets
If wSheet.Name <> Me.Name Then
M = M + 1
With wSheet
.Range("H1").Name = "Start" & wSheet.Index
.Hyperlinks.Add Anchor:=.Range("x1"), Address:="", SubAddress:="Index", TextToDisplay:="Tilbake til oppskrifter"
End With
Me.Hyperlinks.Add Anchor:=Me.Cells(M, 1), Address:="", SubAddress:="Start" & wSheet.Index, TextToDisplay:=wSheet.Name
End If
Next wSheet
Columns("A:A").Select
With Selection.Font
.Size = 16
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = False
.TintAndShade = 0
End With
With Selection.Font
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
End With
Range("A4").Select
ActiveWorkbook.Worksheets("Recipe").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Recipe").Sort.SortFields.Add Key:=Range("A4") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Recipe").Sort
.SetRange Range("A4:A120")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.AutoFilter
End Sub"
This list all the worksheets, set hyperlink to the sheet and sort them.
What i want to do is to is to get a value from cell B2 in that sheet returned to collum B in index sheet locked to the sheet name.
This could be in VBA code to the index sheet, a macro or formula.
ANY HELP WILL DO!
(Have example file but dont know how to upload it)