*thanks Daniel Ji for the reply... here what I need and what the code doesn't do.* * * *This code runs as long as the Sheets("1").Cells(2, ColNumber) = Sheets("Name").Cells(RowCounter, 1) but doesn't do the job. I have some data with a lot of variables in sheet "1" of which I need few variable listed in Sheet "Name" Column A. I want to delete all column from Sheet 1 which doesn't match with variable listed in Sheet "Name" Column A.* * * *Thanks *
On Sun, Feb 20, 2011 at 6:39 PM, Daniel <dcolarde...@free.fr> wrote: > Hello, > > What is not working ? Do you get an error ? > > What are you trying to do ? > > Daniel > > > > *De :* excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] > *De la part de* rakesh kumar > *Envoyé :* dimanche 20 février 2011 11:16 > *À :* excel-macros@googlegroups.com > *Objet :* $$Excel-Macros$$ CODE DOESN'T WORK > > > > Hi Dearests, > > > > Could anyone help me and make the below code work .... ? > > > > Dim GetVarCounts As Integer > > Dim ColName As Integer, RowCounter As Integer > > Dim oRg As Range > > > > > > RowCounter = 1 > > > > For ColName = 1 To 750 > > > > If Sheets("1").Cells(2, ColName) = Sheets("Name").Cells(RowCounter, > 1) Then > > Sheets("1").Cells(1, ColName) = 1 > > RowCounter = RowCounter + 1 > > Else > > Sheets("1").Cells(1, ColName) = 0 > > End If > > 'Application.ScreenUpdating = False > > Next ColName > > > > RowCounter = 1 > > For Each c In Worksheets("1").Range("A1:a750").Cells > > If c.Value = 0 Then > > Columns(RowCounter).EntireColumn.Delete > > End If > > RowCounter = RowCounter + 1 > > Next > > > > > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/discussexcel > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/discussexcel > -- Rakesh kumar khowal +91 9540084660 +91 9868532105 -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel