ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple Question (https://www.excelbanter.com/excel-programming/338079-re-simple-question.html)

Jim Thomlinson[_4_]

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


Jim Thomlinson[_4_]

Simple Question
 
Disregard this... It is a response to a different thread. I must be losing it
(assuming I had it in the first place)
--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

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



All times are GMT +1. The time now is 03:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com