I'm pretty new to VBA and I need a piece of code to apply in the same way to some work sheets in my workbook.
The name of the worksheets I need the code to be applied are as follows:
Analysis Flow Racking % Refill
Analysis Flow Racking 1 Picks
Analysis Line Cupboards %Refill
Analysis Line Cupboards by Pick
Analysis PFB
Analysis Cupboards % Refill
Analysis Cupboards by Picks
Analysis Flow Racking 2 Picks
The code is found below: Any help that you can provide will be much appreciated. Many thanks
Sub AddCheckBox()
Application.ScreenUpdating = False
Dim cell As Range
DelCheckBox 'Do the delete macro
'or delete all checkboxes in the worksheet
' ActiveSheet.CheckBoxes.Delete
ActiveWindow.View = xlNormalView
lastRow = ActiveSheet.Range("B" & ActiveSheet.Rows.Count).End(xlUp).Row
For Each cell In Range("A5:A" & lastRow)
With ActiveSheet.CheckBoxes.Add(cell.Left, _
cell.Top, cell.Width, cell.Height)
.LinkedCell = cell.Offset(, 8).Address(External:=True)
'.Interior.ColorIndex = 37 'or xlNone or xlAutomatic
.Caption = ""
'.Border.Weight = xlThin
End With
Next
With Range("A5:A" & lastRow)
.Rows.RowHeight = 15
Worksheets("Analysis Flow Racking % Refill ").CheckBoxes.Select
Selection.ShapeRange.Align msoAlignCenters, msoFalse
Selection.ShapeRange.IncrementLeft 50
Range("A10000").Select
End With
ActiveWindow.View = xlPageLayoutView
Application.ScreenUpdating = True
End Sub