HI
I have the following macro and im trying to get it to autorun on workbook open but it keep telling me it duplicated. I know it is but its on 2 different worksheets.
Any ideas?
I have the following macro and im trying to get it to autorun on workbook open but it keep telling me it duplicated. I know it is but its on 2 different worksheets.
Any ideas?
VBA Code:
Private Sub Workbook_Open()
Sheets("CUBIC MACHINES").Select
Dim c As Range, r As Range
For Each c In ActiveSheet.UsedRange
If c.Locked = False Then
If r Is Nothing Then
Set r = c
Else
Set r = Union(r, c)
End If
End If
Next
If r Is Nothing Then Exit Sub
r.ClearContents
Sheets("WORLDLINEMACHINES").Select
Dim c As Range, r As Range
For Each c In ActiveSheet.UsedRange
If c.Locked = False Then
If r Is Nothing Then
Set r = c
Else
Set r = Union(r, c)
End If
End If
Next
If r Is Nothing Then Exit Sub
r.ClearContents
Sheets("CUBIC MACHINES").Select
ActiveWindow.SmallScroll Down:=12
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)"
Range("F39").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)"
Range("I39").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)"
Range("L39").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)"
Range("M37").Select
End Sub