PC Review


Reply
Thread Tools Rate Thread

Deleting columns if value of cell is not matching

 
 
Vikram
Guest
Posts: n/a
 
      21st Apr 2010
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 With Quote
 
 
 
 
Otto Moehrbach
Guest
Posts: n/a
 
      21st Apr 2010
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" <(E-Mail Removed)> wrote in message
news:FE5B58AC-A38F-4414-9D43-(E-Mail Removed)...
> 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 With Quote
 
Vikram
Guest
Posts: n/a
 
      22nd Apr 2010
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" <(E-Mail Removed)> wrote in message
> news:FE5B58AC-A38F-4414-9D43-(E-Mail Removed)...
> > 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 With Quote
 
Otto Moehrbach
Guest
Posts: n/a
 
      22nd Apr 2010
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" <(E-Mail Removed)> wrote in message
news:817C945D-EAC5-4662-9124-(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:FE5B58AC-A38F-4414-9D43-(E-Mail Removed)...
>> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Matching 2 columns Vic Microsoft Excel Misc 9 29th Apr 2009 11:46 PM
matching columns Peter Microsoft Excel Worksheet Functions 1 18th Nov 2007 08:19 PM
matching and deleting =?Utf-8?B?bXJoYXJwbzJ1?= Microsoft Excel Misc 4 27th Jun 2006 01:05 AM
Parent Columns and Child Columns don't have type-matching columns microsoft news Microsoft ADO .NET 1 21st Sep 2004 10:08 AM
Matching and deleting data Nick Microsoft Excel Worksheet Functions 6 22nd Oct 2003 05:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:05 PM.