Martin_H
Board Regular
- Joined
- Aug 26, 2020
- Messages
- 190
- Office Version
- 365
- Platform
- Windows
Hi,
I am using this macro - which is assigned to custom ribbon UI button - on multiple worksheets (withing one workbook).
As you can see I am using a specific name Table1 and I would love to change it to some universal name. There is always only one table per worksheet.
Thank you!
I am using this macro - which is assigned to custom ribbon UI button - on multiple worksheets (withing one workbook).
As you can see I am using a specific name Table1 and I would love to change it to some universal name. There is always only one table per worksheet.
Thank you!
VBA Code:
Public Sub DELETE(ByRef control As Office.IRibbonControl)
With Application
.ScreenUpdating = False
Range("Table1[[#Headers],[Machine]]").AutoFilter
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=12, Criteria1:=Array("Machine1", "Machine2", "Machine3", "Machine4", "Machine5", ""), Operator:=xlFilterValues
ActiveSheet.ListObjects("Table1").ShowAutoFilterDropDown = False
Dim LastCell As Range
With ActiveSheet
Set LastCell = .Cells(Rows.Count, 2).End(xlUp)
.Range("D5", LastCell).sort Key1:=.Range("D1"), Order1:=xlAscending, Header:=xlYes, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortTextAsNumbers
End With
With Range("B3").Font
.Color = -10027162: .TintAndShade = 0: .Bold = True
End With
With Range("D3,N3,O3,P3,Q3.F3").Font
.ThemeColor = xlThemeColorDark1: .TintAndShade = 0: .Bold = False
End With
Range("B2").Select
.ScreenUpdating = True
End With
End Sub