Hi All,
I keep getting a application-object defined error.on this line
Set LastR = .Range("A65500").End(x1up).Select
Can someone tell me what im doing wrong?
I keep getting a application-object defined error.on this line
Set LastR = .Range("A65500").End(x1up).Select
Can someone tell me what im doing wrong?
Code:
Public Sub CommandButton1_Click()
Dim ws As Worksheet
Dim LastR As Range
'clears the worksheet
Sheets("All Sheets").Select
Cells.Select
Selection.Interior.ColorIndex = xlNone
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Selection.Delete Shift:=xlUp
Range("A1").Select
Rows("1:1").RowHeight = 72
'grabs all the data from the worksheet and puts it in the "allsheets" tab
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "All Sheets" Then
With Sheets("All Sheets")
Set LastR = .Range("A65500").End(x1up).Select
End With
ActiveCell.Offset(1, 0).Range("A1").Select
If IsEmpty(Range("A1")) Then Set LastR = Range("A1")
ws.Range("A1:AM3000").Copy LastR
End If
Next
Selection.End(xlUp).Select
End Sub