I am attempting to create a summary sheet where there will be 46 rows of data over 7 columns. Thus, I will be pulling the data from 46 sheets and there will be 7 different points of data.
Can I use offset function to simplify this code e.g.
Sub AutoFillSheetNames()
Dim ActRng As Range
Dim ActWsName As String
Dim ActAddress As String
Dim Ws As Worksheet
On Error Resume Next
Set ActRng = Application.ActiveCell
ActWsName = Application.ActiveSheet.Name
ActAddress = ActRng.Address(False, False)
Application.ScreenUpdating = False
xIndex = 0
For Each Ws In Application.Worksheets
If Ws.Name <> ActWsName Then
ActRng.Offset(xIndex, 0).Value = "='" & Ws.Name & "'!" & ActAddress
xIndex = xIndex + 1
End If
Next
Application.ScreenUpdating = True
End Sub
I would like to link the actual cells so they can update automatically and VBA is needed because it will be done for many different excel workbooks with different tabnames. The code posted here works when, for example, I link cell F2 on Summary sheet to F2 on the first sheet of 48 sheets and then correctly inputs the formula for the remaining 47 cells down to F48. However, when I want to link cell H2 on summary sheet to G7 on the first sheet, what should I change in the code above?
On Error Resume Next
without using a proper error handling. This way you only mute error messages but the errors are still there and you don't see what's going wrong. – Pᴇʜ