I'm trying to run a macro that corrects a linked cell designation with checkboxes within a set of workbooks.
There are many (around 100) workbooks that need adjusting in one file.
As such I am looping through these files and running the reassignment, however, it only ever applies to the file in which I wrote the macro:
Sub CheckBoxesControl()
On Error Resume Next
Dim path As String
Dim file As String
Dim wkbk As Workbook
Dim i As Long
Application.ScreenUpdating = False
Application.DisplayAlerts = False
path = "C:\file\path\"
file = Dir(path)
Do While Not file = ""
Workbooks.Open (path & file)
Set wkbk = ActiveWorkbook
For i = 1 To 400
ActiveWorkbook.Sheet4.CheckBoxes("Check Box " & i).LinkedCell = "ChkBoxOutput!AA" & i
ActiveWorkbook.Sheet21.CheckBoxes("Check Box " & i).LinkedCell = "ChkBoxOutput!AB" & i
Activekbook.Sheet22.CheckBoxes("Check Box " & i).LinkedCell = "ChkBoxOutput!AC" & i
Next i
wkbk.Save
wkbk.Close
file = Dir
Loop
End Sub
Can anyone tell me how to adjust it so that it is applied to each file?
The macro runs without errors (and indeed each file in the file does seem to be opened and closed).