Thrasher857
New Member
- Joined
- Sep 10, 2010
- Messages
- 3
So, my girlfriend is a teacher. Her school is FINALLY requiring them to track real-time data usage on her students. I'm not new to excel, I'm a scientist who tracks thousands of lines of data everyday, but VBA and macros aren't my specialty.
I have put together the module below, and would like help with the line commented out for automatically creating hyperlinks. Or any suggestions for a complete overhaul of this sub. Her student names are in a worksheet "Students" A2:A31.
____________________________________________________________
Sub CreateSheetsFromAList()
Dim MyCell As Range, MyRange As Range
Application.ScreenUpdating = False
Range("A2:G31").Select
Range("G31").Activate
ActiveWorkbook.Worksheets("Students").sort.SortFields.Clear
ActiveWorkbook.Worksheets("Students").sort.SortFields.Add Key:=Range("A2:A31" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Students").sort
.SetRange Range("A2:G31")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Set MyRange = Sheets("Students").Range("A2")
Set MyRange = Range(MyRange, MyRange.End(xlDown))
For Each MyCell In MyRange
Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
Sheets(Sheets.Count).Name = MyCell.Value 'renames the new worksheets
'PLEASE HELP WITH THE LINE BELOW, I'D LIKE A HYPERLINK TO OCCUR BETWEEN THE STUDENTS NAME AND STUDENTS TAB
'ActiveSheets.Hyperlinks.Add Anchor:=MyCell, Address:=(="Sheets(Sheets.Count)"), SubAddress:=("Sheets(Sheets.Count)"), TextToDisplay:=MyCell.Value
Next MyCell
Worksheets("Students").Activate
Application.ScreenUpdating = True
End Sub
____________________________________________________________
I have come across mrexcel when I began learning VBA, and this seems like it is populated with very useful registrants. Please help me develop this tool not only for my gf, but an entire school district. She only has 6 students, but I'm building this file for up-to 30. (What they came up with was absolutely ridiculous, I laughed so hard I think I wet myself)
I have put together the module below, and would like help with the line commented out for automatically creating hyperlinks. Or any suggestions for a complete overhaul of this sub. Her student names are in a worksheet "Students" A2:A31.
____________________________________________________________
Sub CreateSheetsFromAList()
Dim MyCell As Range, MyRange As Range
Application.ScreenUpdating = False
Range("A2:G31").Select
Range("G31").Activate
ActiveWorkbook.Worksheets("Students").sort.SortFields.Clear
ActiveWorkbook.Worksheets("Students").sort.SortFields.Add Key:=Range("A2:A31" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Students").sort
.SetRange Range("A2:G31")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Set MyRange = Sheets("Students").Range("A2")
Set MyRange = Range(MyRange, MyRange.End(xlDown))
For Each MyCell In MyRange
Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
Sheets(Sheets.Count).Name = MyCell.Value 'renames the new worksheets
'PLEASE HELP WITH THE LINE BELOW, I'D LIKE A HYPERLINK TO OCCUR BETWEEN THE STUDENTS NAME AND STUDENTS TAB
'ActiveSheets.Hyperlinks.Add Anchor:=MyCell, Address:=(="Sheets(Sheets.Count)"), SubAddress:=("Sheets(Sheets.Count)"), TextToDisplay:=MyCell.Value
Next MyCell
Worksheets("Students").Activate
Application.ScreenUpdating = True
End Sub
____________________________________________________________
I have come across mrexcel when I began learning VBA, and this seems like it is populated with very useful registrants. Please help me develop this tool not only for my gf, but an entire school district. She only has 6 students, but I'm building this file for up-to 30. (What they came up with was absolutely ridiculous, I laughed so hard I think I wet myself)