Rowland Hamilton
Active Member
- Joined
- Nov 13, 2009
- Messages
- 250
Folks,
How do I replace all selections with activations in this code:
I tried skipping the first line and altering the 2nd line this way, but it didn't work:
relys on this:
THank you,
Rowland Hamilton
How do I replace all selections with activations in this code:
Code:
'Delete Filtered Rows (how to remove selection?)
Range("a2", Selection.SpecialCells(xlCellTypeLastCell)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.EntireRow.Delete
I tried skipping the first line and altering the 2nd line this way, but it didn't work:
Code:
rngTable.SpecialCells(xlTypeVisible).Activate
relys on this:
Code:
Sub Remove_Dupes() '(wsR As Worksheet) 'passthrough
Dim wsR As Worksheet 'Results worksheet - not needed with passthrough
Dim lngFRow As Long 'First row
Dim lngLRow As Long 'Last row
Dim lngLCol As Long 'Last column
Dim rngTable As Range 'Table data
Set wsR = Worksheets("Results") 'not needed with passthrough
'Find last row
lngFRow = wsR.Range("A1").End(xlDown).Row
lngLRow = wsR.Range("A" & Rows.Count).End(xlUp).Row
lngLCol = wsR.UsedRange.Columns.Count
'Remove any existing filter
wsR.Activate
wsR.AutoFilterMode = False
'Set approximate table range
Set rngTable = wsR.Range(wsR.Cells(lngFRow - 1, 1), wsR.Cells(lngLRow, lngLCol))
'Apply new filter
rngTable.Activate
rngTable.AutoFilter
'Filter for blanks
rngTable.AutoFilter Field:=1, Criteria1:="=", _
Operator:=xlOr, Criteria2:="=*PLACE_HOLDER*"
'Delete Filtered Rows (how to remove selection?)
'ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Activate
Application.CutCopyMode = False
'Range("a2", Selection.SpecialCells(xlCellTypeLastCell)).Select
'Selection.SpecialCells(xlCellTypeVisible).Select
rngTable.SpecialCells(xlTypeVisible).Activate
Stop
'Selection.EntireRow.Delete
ActiveSheet.AutoFilterMode = False
End Sub
Rowland Hamilton