Sub ABC()
Dim lastrow As Long, i As Long
Dim bGreater As Boolean
Dim j As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
i = 1
Do While Cells(1, i + 1) <> ""
bGreater = True
For j = 1 To lastrow
If Cells(j, i) < Cells(j, i + 1) Then
bGreater = False
Exit For
End If
Next
If bGreater Then
Columns(i).EntireColumn.Delete
Else
i = i + 1
End If
Loop
End Sub
--
Regards,
Tom Ogilvy
"sreedhar" <sreedhar.1wy8ab_1129388704.5241@excelforum-nospam.com> wrote in
message news:sreedhar.1wy8ab_1129388704.5241@excelforum-nospam.com...
>
> hi,
>
> i want a macro for comparing columns.
>
>
> for ex
>
> A B C
> 1 1 1 .........
> 0 0 0 .........
> 1 0 0 .........
> 1 0 1 .........
> .......
> .........
> .......
>
>
> if A compared with B
> 1>1,0>0,1>0,1>0
> so A is greater than B so column A should be deleted
>
> like wise we have to compare each and every cell in the column
> and compare all columns up to end of excel sheet
>
> So,plz can any one help me regarding this
>
> thanks
> sree
>
>
> --
> sreedhar
> ------------------------------------------------------------------------
> sreedhar's Profile:
http://www.excelforum.com/member.php...o&userid=27582
> View this thread: http://www.excelforum.com/showthread...hreadid=476492
>
Bookmarks