Sub SelectCells()
Dim LR As Long, c As Range
Application.ScreenUpdating = False
LR = Range("a" & Rows.Count).End(xlUp).Row
For Each c In Range("A1:A" & LR)
If c.Value <> "When" And c.Value <> "//" Then
c.EntireRow.Hidden = True
End If
Next c
With Range("A1:A" & LR)
.SpecialCells(xlCellTypeVisible).EntireRow.Select
.RowHeight = 15
End With
Application.ScreenUpdating = True
End Sub
Option Explicit
Sub mySelection()
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Columns("B:B").Insert
Range(Cells(1, 2), Cells(LastRow, 2)).FormulaR1C1 = _
"=IF((RC[-1]=""when"")+(RC[-1]=""//""),1,"""")"
Range(Cells(1, 2), Cells(LastRow, 2)). _
SpecialCells(xlCellTypeFormulas, 1).EntireRow.Select
Columns("B:B").Delete
Application.ScreenUpdating = True
End Sub
That is quite likely because that code is case-sensitive (When/when)I tried the first codeblock and it didnt' work ..
Bmoore45,Thanks guys, I tried the first codeblock and it didnt' work but the second worked fine for me, cheers
Option Explicit
Sub mySelection()
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Columns("B:B").Insert
Range(Cells(1, 2), Cells(LastRow, 2)).FormulaR1C1 = _
"=IF((RC[-1]=""when"")+(RC[-1]=""//""),1,"""")"
[COLOR=blue]On Error Resume Next[/COLOR]
Range(Cells(1, 2), Cells(LastRow, 2)). _
SpecialCells(xlCellTypeFormulas, 1).EntireRow.Select
[COLOR=blue]On Error GoTo 0[/COLOR]
Columns("B:B").Delete
Application.ScreenUpdating = True
End Sub