View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_4_] Jim Thomlinson[_4_] is offline
external usenet poster
 
Posts: 1,119
Default Simple Question

My fault... I had the Instr arguments backwards... Sorry about that

Sub DeleteSheets()
Dim wks As Worksheet
On Error GoTo ErrorHandler

Application.DisplayAlerts = False
For Each wks In Worksheets
If InStr(UCase(wks.Name), "BILL") 0 Then wks.Delete
Next wks
ErrorHandler:
Application.DisplayAlerts = True

End Sub
--
HTH...

Jim Thomlinson


"Eric" wrote:

Hi guys,

How do I get my code to work if the activecell is in Column J, I'll need to
go back 3 columns and down one row? My code below doesn't work.

If Columns("J:J") Then ActiveCell.Offset(1,-3).Select