Method 'Range' of object '_Global' failed - Error when attempting to invoke macro via button

Viewed 31

First time StackOverflow Q, please let me know if I'm failing some hidden etiquette.

Been attempting to unpick this error here from an inherited spreadsheet. Whe we invoke the VBcode it throws the error, debug console displays the below code block.

The error is on the fourth line, "Range ("inv_line")...

You will have to forgive me for not having a full understanding of the sheets inner workings, but I'm more than happy to provide further information where required and possible.

SOS

Sub Insert_Invoice_Line()
ActiveSheet.Unprotect
Sheets("Costing").Select
Range("Inv_Line").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("Inv_Unit") = "=SUM(Inv_Unit_1st:R[-1]C)"
Range("Inv_Price") = "=Inv_Total/Inv_Unit"
Range("Inv_Total_1st", "Inv_Total") = "=RC[-2]*RC[-1]"
Range("Inv_Total") = "=SUM(Inv_Total_1st:R[-1]C)"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

Sub Insert_Costing()
ActiveSheet.Unprotect
Sheets("Costing").Select
    Range("Costing").Copy
    Range("ZZ3").End(xlToLeft).Offset(0, 1).Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveWorkbook.Names("AV_Price").RefersToR1C1 = Sheets("Costing").Range("M3:Q3")
    ActiveWorkbook.Names("AV_Cost").RefersToR1C1 = Sheets("Costing").Range("M4:Q4")
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

Sub insert_Purcase_Inv()
ActiveSheet.Unprotect
Sheets("Costing").Select
    Range("B9:M9").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("I9").FillDown
    Range("B9").FillDown
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

Sub snip()
If [chk] = True Then Exit Sub
Sheets("Open Cost").Range("B1:J33").CopyPicture xlScreen, xlBitmap
End Sub
Sub load_Size_Younger()

Dim col As Integer, i As Integer, lst As Integer
If [chk] = True Then Exit Sub
ActiveSheet.Unprotect
Sheets("Order Details").Select
Range("Size_Start", [Size_Start].End(xlToRight)).ClearContents
Range("Size_Start", [Size_Start].End(xlToRight)).ClearFormats
Range("Younger").Copy

Range("Size_Start").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Application.CutCopyMode = False
Range("Size_Start", [Size_Start].End(xlToRight).Offset(0, 1)).Orientation = 35
col = Range("Size_Start").End(xlToRight).Offset(0, 1).Column
Selection.VerticalAlignment = xlCenter
Selection.HorizontalAlignment = xlCenter
Selection.Locked = False
For i = 1 To 20
If Not Cells(Range("Size_Start").Row + i, "A").Borders(xlEdgeBottom).LineStyle = xlContinuous Then lst = Range("Size_Start").Row + i - 1: Exit For
Next i
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With

Range("Size_Start").End(xlToRight).Offset(0, 1) = "Total"
Range("Size_Start").End(xlToRight).Interior.Color = 14610923
Range("Size_Start").End(xlToRight).Font.Bold = True
Range("Size_Start").End(xlToRight).VerticalAlignment = xlCenter
Range("Size_Start").End(xlToRight).HorizontalAlignment = xlCenter


Range(Rows(Range("Size_Start").Row + 1), Rows(lst)).ClearFormats
Range(Cells(Range("Size_Start").Row + 1, "A"), Cells(lst, col)).Select
Call do_lines
Range(Cells(Range("Size_Start").Row, "A"), Cells(Range("Size_Start").Row, col - 1)).Select

Range(Cells(Range("Size_Start").Row, col), Cells(lst, col)).Select
Call Do_bold_line
Range("Size_Start").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Sub load_Size_Older()

If [chk] = True Then Exit Sub
ActiveSheet.Unprotect
Sheets("Order Details").Select
Range("Size_Start", [Size_Start].End(xlToRight)).Clear
Range("Older").Copy

Range("Size_Start").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Application.CutCopyMode = False
Range("Size_Start", [Size_Start].End(xlToRight).Offset(0, 1)).Orientation = 45
col = Range("Size_Start").End(xlToRight).Offset(0, 1).Column
Selection.VerticalAlignment = xlCenter
Selection.HorizontalAlignment = xlCenter
Selection.Locked = False
For i = 1 To 20
If Not Cells(Range("Size_Start").Row + i, "A").Borders(xlEdgeBottom).LineStyle = xlContinuous Then lst = Range("Size_Start").Row + i - 1: Exit For
Next i
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With

Range("Size_Start").End(xlToRight).Offset(0, 1) = "Total"
Range("Size_Start").End(xlToRight).Interior.Color = 14610923
Range("Size_Start").End(xlToRight).Font.Bold = True
Range("Size_Start").End(xlToRight).VerticalAlignment = xlCenter
Range("Size_Start").End(xlToRight).HorizontalAlignment = xlCenter


Range(Rows(Range("Size_Start").Row + 1), Rows(lst)).ClearFormats
Range(Cells(Range("Size_Start").Row + 1, "A"), Cells(lst, col)).Select
Call do_lines
Range(Cells(Range("Size_Start").Row, "A"), Cells(Range("Size_Start").Row, col - 1)).Select

Range(Cells(Range("Size_Start").Row, col), Cells(lst, col)).Select
Call Do_bold_line
Range("Size_Start").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Sub load_Size_Mens()
If [chk] = True Then Exit Sub
ActiveSheet.Unprotect
Sheets("Order Details").Select
Range("Size_Start", [Size_Start].End(xlToRight)).Clear
Range("Mens").Copy

Range("Size_Start").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Application.CutCopyMode = False
'Range("Size_Start", [Size_Start].End(xlToRight).Offset(0, 1)).Orientation = 35
col = Range("Size_Start").End(xlToRight).Offset(0, 1).Column
Selection.VerticalAlignment = xlCenter
Selection.HorizontalAlignment = xlCenter
Selection.Locked = False
For i = 1 To 20
If Not Cells(Range("Size_Start").Row + i, "A").Borders(xlEdgeBottom).LineStyle = xlContinuous Then lst = Range("Size_Start").Row + i - 1: Exit For
Next i
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With

Range("Size_Start").End(xlToRight).Offset(0, 1) = "Total"
Range("Size_Start").End(xlToRight).Interior.Color = 14610923
Range("Size_Start").End(xlToRight).Font.Bold = True
Range("Size_Start").End(xlToRight).VerticalAlignment = xlCenter
Range("Size_Start").End(xlToRight).HorizontalAlignment = xlCenter


Range(Rows(Range("Size_Start").Row + 1), Rows(lst)).ClearFormats
Range(Cells(Range("Size_Start").Row + 1, "A"), Cells(lst, col)).Select
Call do_lines
Range(Cells(Range("Size_Start").Row, "A"), Cells(Range("Size_Start").Row, col - 1)).Select

Range(Cells(Range("Size_Start").Row, col), Cells(lst, col)).Select
Call Do_bold_line
Range("Size_Start").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
0 Answers
Related