ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sort Cells? (https://www.excelbanter.com/excel-programming/376485-sort-cells.html)

Victor[_6_]

Sort Cells?
 
I've got an Excel worksheet where the first column contains a keyword. I want to have a
button, or an option, or whatever, that I can click so that if the first column equals a
certain word, then do not display the row containing that column.

How can I do this, please???

Thanks!

Vic




Tom Ogilvy

Sort Cells?
 
Sub Hiderows()
Dim cell as Range
for each cell in Activesheet.UsedRange.columns(1).Cells
if instr(1,cell,"TestWord",vbTextcompare) then
cell.EntireRow.Hidden = True
else
cell.EntireRow.Hidden = False
end if
Next
End Sub

--
regards,
Tom Ogilvy


"Victor" wrote:

I've got an Excel worksheet where the first column contains a keyword. I want to have a
button, or an option, or whatever, that I can click so that if the first column equals a
certain word, then do not display the row containing that column.

How can I do this, please???

Thanks!

Vic





Victor[_6_]

Sort Cells?
 
Thank you, Tom!

Vic





All times are GMT +1. The time now is 01:38 AM.

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