I've added the last row to select case code see below. The error says
Method Range of Object _Worksheet Failed
Not too sure how to deal with the error?
Does it mean it cant find the range on the worksheet? I
ve put the color procedure below for you to see
The code works fine except for the Last Row in the ranges
Option Explicit
Private Sub Add_Break_Lines_Click()
Dim Com As ComboBox
Dim ws As Worksheet
Set ws = Application.Workbooks("Automated ardworker.xlsm").Worksheets("Job Card Master")
Set Com = Me.Add_Break_Lines
LastRow = ws.Range("C299").End(xlUp).row
With ws
Select Case Com.Value
Case "Break Lines 1 Page Job Card"
Color .Range("A13:Q & LastRow")
End Select
End With
End Sub
Function Color(rng As Range)
Dim row As Range
Dim EmptyRowNum As Integer
For i = 1 To rng.Rows.Count
Set row = rng.Rows(i)
If WorksheetFunction.CountA(row) = 0 Then
EmptyRowNum = EmptyRowNum + 1
End If
If EmptyRowNum = 2 Then
EmptyRowNum = 0
row.Interior.ColorIndex = 6
End If
Next i
End Function