I keep getting this error when running this code, The ranges are named on the sheet and i double checked them to match, I can't figure it out
It gives me and error o
Range("LVL7Drawing, LVL7Material, LVL7Description, LVL7Dimension").Select
Complete action
Private Sub CommandButton2_Click()
Dim ws As Worksheet
Dim MyRange As Range
Dim LastRow As Long
Range("LVL7Drawing, LVL7Material, LVL7Description, LVL7Dimension").Select
Range("LVL7Drawing, LVL7Material, LVL7Description, LVL7Dimension").Copy
Set ws = Worksheets.Add
With ws.Range("B2")
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
LastRow = ActiveSheet.Range("B" & Rows.Count).End(xlUp).Row
Set MyRange = ActiveSheet.Range("B2:E" & LastRow)
MyRange.RemoveDuplicates Columns:=2, Header:=xlNo
'Autofit column
ws.Columns("A").AutoFit
'Autofit column
ws.Columns("B").AutoFit
'Autofit column
ws.Columns("C").AutoFit
'Autofit column
ws.Columns("D").AutoFit
End With
End Sub
Bookmarks