ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sorting code problems (https://www.excelbanter.com/excel-programming/311349-sorting-code-problems.html)

DKY[_14_]

sorting code problems
 

Okay, here goes. The only reason I wanted to sort was so I could delet
the rows that have any other number besides 26 in column C. So, I foun
this code on the site and am currently trying to make it so that i
looks in Column C, and if there's anything besides the number 26 i
that column, it deletes the row. Then when its finished it hide
column C.

Dim rng as Range, sStr as String, i as Long
set rng = cells(1,"IV").End(xltoLeft)
for i = rng.column to 1 step -1
sStr = lcase(cells(1,i).Value)
if sStr < "first name" and _
sStr < "surname" and _
sStr < "score" then
cells(1,i).EntireColumn.Delete
end if
Nex

--
DK
-----------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...fo&userid=1451
View this thread: http://www.excelforum.com/showthread.php?threadid=26315



All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com