Ok based on all the comments across all the posts here is an adaptation of Maciej Los' solution on your other post... this could be run from a button on the main sheet
Sub AddLinks()
Dim srcWbk As Workbook, dstWbk As Workbook
Dim srcWsh As Worksheet, dstWsh As Worksheet
Dim i As Integer, j As Integer
Dim s As String
On Error GoTo Err_AddLinks
Set srcWbk = ThisWorkbook
Set srcWsh = srcWbk.Worksheets("Sheet1")
Set dstWbk = Application.Workbooks("student")
For i = 1 To dstWbk.Worksheets.Count
Set dstWsh = dstWbk.Worksheets(i)
If dstWsh.Name <> "Sheet1" Then
s = "=Sheet1!B" + CStr(i + 2)
dstWsh.Range("B2").Formula = s
End If
Next
Exit_AddLinks:
On Error Resume Next
Set srcWbk = Nothing
Set srcWsh = Nothing
Set dstWbk = Nothing
Set dstWsh = Nothing
Exit Sub
Err_AddLinks:
MsgBox Err.Description, vbExclamation, Err.Number
Resume Exit_AddLinks
End Sub
But you also mentioned (somwhere) that you would like this to run automatically everytime you add a new sheet to the workbook in which case something like this added to the
ThisWorkbook
code page would work
Private Sub Workbook_NewSheet(ByVal Sh As Object)
On Error GoTo Err_NewSheet
s = "Sheet1!B" + CStr(ThisWorkbook.Worksheets.Count + 2)
Sh.Range("B2").Formula = "=" & s
Exit Sub
Err_NewSheet:
MsgBox Err.Description, vbExclamation, Err.Number
End Sub