R
RyanH
I am getting an error indicated below in my code (Application-defined or
object-defined Error, Run-Time Error '1004'). I want to have a border every
5 lines. Can someone explain to me why this portion of code will not work?
Huge THANKS in advanced!!!
Sub JobTracker1()
Application.ScreenUpdating = False
Call shUnProtect
RowCount = 3
With Sheets("Archive")
Do While .Range("L" & RowCount) <> ""
myMonth = Format(.Range("L" & RowCount), "mmmm")
Application.StatusBar = "Moving Sales Orders from Archive to " &
myMonth & "...Please Wait."
With Sheets(myMonth)
If IsEmpty(.Range("A3")) = True Then
Sheets("Archive").Range("A" & RowCount & "" & RowCount).Cut
.Paste Destination:=.Range("A3")
Sheets("Archive").Range("Q" & RowCount & ":BO" & RowCount).Cut
.Paste Destination:=.Range("T3")
Else
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
NewRow = LastRow + 1
Sheets("Archive").Range("A" & RowCount & "" & RowCount).Cut
.Paste Destination:=.Range("A" & NewRow)
Sheets("Archive").Range("Q" & RowCount & ":BO" & RowCount).Cut
.Paste Destination:=.Range("T" & NewRow)
End If
With .Cells
.Interior.ColorIndex = 41
.Font.ColorIndex = 2
End With
.UsedRange.FormatConditions.Add Type:=xlExpression,
Formula1:="=MOD(ROW(),5)=0" <==ERROR ERROR ERROR
With .UsedRange.FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
RowCount = RowCount + 1
Loop
End With
Application.StatusBar = False
Application.CutCopyMode = False
Application.ScreenUpdating = False
Call shProtect
End Sub
object-defined Error, Run-Time Error '1004'). I want to have a border every
5 lines. Can someone explain to me why this portion of code will not work?
Huge THANKS in advanced!!!
Sub JobTracker1()
Application.ScreenUpdating = False
Call shUnProtect
RowCount = 3
With Sheets("Archive")
Do While .Range("L" & RowCount) <> ""
myMonth = Format(.Range("L" & RowCount), "mmmm")
Application.StatusBar = "Moving Sales Orders from Archive to " &
myMonth & "...Please Wait."
With Sheets(myMonth)
If IsEmpty(.Range("A3")) = True Then
Sheets("Archive").Range("A" & RowCount & "" & RowCount).Cut
.Paste Destination:=.Range("A3")
Sheets("Archive").Range("Q" & RowCount & ":BO" & RowCount).Cut
.Paste Destination:=.Range("T3")
Else
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
NewRow = LastRow + 1
Sheets("Archive").Range("A" & RowCount & "" & RowCount).Cut
.Paste Destination:=.Range("A" & NewRow)
Sheets("Archive").Range("Q" & RowCount & ":BO" & RowCount).Cut
.Paste Destination:=.Range("T" & NewRow)
End If
With .Cells
.Interior.ColorIndex = 41
.Font.ColorIndex = 2
End With
.UsedRange.FormatConditions.Add Type:=xlExpression,
Formula1:="=MOD(ROW(),5)=0" <==ERROR ERROR ERROR
With .UsedRange.FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
RowCount = RowCount + 1
Loop
End With
Application.StatusBar = False
Application.CutCopyMode = False
Application.ScreenUpdating = False
Call shProtect
End Sub