Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Deleting columns if value of cell is not matching

Hello All,
I have one workbook which contains 20-30 sheets and from these i would like
to check whether column C1="Expired" if value is matching then i would like
to delete entire column from all the sheets except two sheet (sheet1 and
sheet2).

Please help in this regard..

Best regards
Vikram
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Deleting columns if value of cell is not matching

You say " i would like to check whether column C1="Expired"...". In what
sheet? Or do you mean you want to look in cell C1 In EACH sheet and, if
found, delete Column C in THAT sheet? As written now, you say you want to
delete column C of EVERY sheet if "Expired" is found in C1 in some (I don't
know which) sheet. HTH Otto



"Vikram" wrote in message
...
Hello All,
I have one workbook which contains 20-30 sheets and from these i would
like
to check whether column C1="Expired" if value is matching then i would
like
to delete entire column from all the sheets except two sheet (sheet1 and
sheet2).

Please help in this regard..

Best regards
Vikram


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Deleting columns if value of cell is not matching

Hello Otto,

I would like to check whether Cell C1 in each sheet contains "expired" and
if yes then delete that column i.e, column C, except 2 sheets

"Otto Moehrbach" wrote:

You say " i would like to check whether column C1="Expired"...". In what
sheet? Or do you mean you want to look in cell C1 In EACH sheet and, if
found, delete Column C in THAT sheet? As written now, you say you want to
delete column C of EVERY sheet if "Expired" is found in C1 in some (I don't
know which) sheet. HTH Otto



"Vikram" wrote in message
...
Hello All,
I have one workbook which contains 20-30 sheets and from these i would
like
to check whether column C1="Expired" if value is matching then i would
like
to delete entire column from all the sheets except two sheet (sheet1 and
sheet2).

Please help in this regard..

Best regards
Vikram


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Deleting columns if value of cell is not matching

This macro will look at all sheets that are NOT named "Sheet1" or "Sheet2",
look for "Expired" in C1 and delete Column C if found. Post back if you
need more. HTH Otto
Sub DeleteExpired()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Sheet1" And ws.Name < "Sheet2" Then
If ws.Range("C1") = "Expired" Then _
ws.Columns("C:C").Delete Shift:=xlToLeft
End If
Next ws
End Sub

"Vikram" wrote in message
...
Hello Otto,

I would like to check whether Cell C1 in each sheet contains "expired" and
if yes then delete that column i.e, column C, except 2 sheets

"Otto Moehrbach" wrote:

You say " i would like to check whether column C1="Expired"...". In what
sheet? Or do you mean you want to look in cell C1 In EACH sheet and, if
found, delete Column C in THAT sheet? As written now, you say you want
to
delete column C of EVERY sheet if "Expired" is found in C1 in some (I
don't
know which) sheet. HTH Otto



"Vikram" wrote in message
...
Hello All,
I have one workbook which contains 20-30 sheets and from these i would
like
to check whether column C1="Expired" if value is matching then i would
like
to delete entire column from all the sheets except two sheet (sheet1
and
sheet2).

Please help in this regard..

Best regards
Vikram


.

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
Deleting Duplicate Rows containing a value matching with a value f emil Excel Programming 4 June 2nd 09 07:53 PM
Checks, Matching and deleting numbers Schwimms Excel Discussion (Misc queries) 2 May 23rd 07 08:59 PM
MATCHING, & DELETING BOTH MATCHES, IN SMALL DATABASE JingleRock Excel Programming 1 November 21st 06 04:56 PM
matching and deleting mrharpo2u Excel Discussion (Misc queries) 4 June 27th 06 01:05 AM
Matching data and linking it to the matching cell yvonne a via OfficeKB.com Links and Linking in Excel 0 July 13th 05 07:30 PM


All times are GMT +1. The time now is 06:35 PM.

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

About Us

"It's about Microsoft Excel"