Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Deleteing a worksheet

I am looking at a particular cell (E5) and if the word Total is in there I
want it to delete the worksheet.

Not sure why the following code doesn't work. Seemd fairly straight forward.

If Sheets("Baton Rouge").Cell(5, 1) = "TOTAL" Then
Sheets("Baton Rouge").Delete
End If

Thanks,

Kevin Porter
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Deleteing a worksheet

By the way it should read Cells not Cell. It does in the program.

"Kevin Porter" wrote:

I am looking at a particular cell (E5) and if the word Total is in there I
want it to delete the worksheet.

Not sure why the following code doesn't work. Seemd fairly straight forward.

If Sheets("Baton Rouge").Cell(5, 1) = "TOTAL" Then
Sheets("Baton Rouge").Delete
End If

Thanks,

Kevin Porter

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Deleteing a worksheet

If Sheets("Baton Rouge").Cell(5, 1) = "TOTAL" Then

Cell must be Cells

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Kevin Porter" wrote in message ...
I am looking at a particular cell (E5) and if the word Total is in there I
want it to delete the worksheet.

Not sure why the following code doesn't work. Seemd fairly straight forward.

If Sheets("Baton Rouge").Cell(5, 1) = "TOTAL" Then
Sheets("Baton Rouge").Delete
End If

Thanks,

Kevin Porter

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Deleteing a worksheet

VBA is case sensitive unless you've done something special like adding this to
the top of the module:

Option Compare Text


You could also use:
If lcase(Sheets("Baton Rouge").Cells(5, 1).value) = lcase("TOTAL") Then

Or you may want to look at strcomp() in VBA's help.





Kevin Porter wrote:

By the way it should read Cells not Cell. It does in the program.

"Kevin Porter" wrote:

I am looking at a particular cell (E5) and if the word Total is in there I
want it to delete the worksheet.

Not sure why the following code doesn't work. Seemd fairly straight forward.

If Sheets("Baton Rouge").Cell(5, 1) = "TOTAL" Then
Sheets("Baton Rouge").Delete
End If

Thanks,

Kevin Porter


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleteing Pictures oceankayakjim New Users to Excel 5 May 11th 09 02:38 PM
Deleteing koba Excel Discussion (Misc queries) 2 November 25th 05 04:11 AM
deleteing duplicates syssupspe Excel Discussion (Misc queries) 2 April 28th 05 12:15 AM
Deleteing some Rows Deepwater Excel Discussion (Misc queries) 1 April 1st 05 06:23 PM
Deleteing Rows Michael Vaughan Excel Programming 2 September 20th 04 09:53 PM


All times are GMT +1. The time now is 10:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"