ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hide rows with macro (https://www.excelbanter.com/excel-programming/330176-hide-rows-macro.html)

Alen32

hide rows with macro
 
I want makro which can find out which cells are empty in area a12:a35 and
hide those rows where cells are empty.


bigwheel

hide rows with macro
 
"Alen32" wrote:

I want makro which can find out which cells are empty in area a12:a35 and
hide those rows where cells are empty.



One way:-

Sub HideRows()
For a = 12 To 35
If Cells(a, 1) = "" Then
Cells(a, 1).Select
Selection.EntireRow.Hidden = True
End If
Next a
End Sub

Alen32

hide rows with macro
 
doesn't work.


bigwheel

hide rows with macro
 
"Alen32" wrote:

doesn't work.


Should do. I trust you copied the lines into a new module
( Alt+F11InsertModule )

Alen32

hide rows with macro
 
it works in some sheets but dosn't work in some others sheets. I don't know
why


bigwheel

hide rows with macro
 
Depends on whether the cells are empty or contain a space, I guess

Alen32

hide rows with macro
 
how to remove space?


Tom Ogilvy

hide rows with macro
 
Sub HideRows()
Dim cell as String
Dim a as Long
For a = 12 To 35
cell = Application.Substitute(Cells(a,1).Text,chr(160),"" )
If Trim(cell) = "" Then
Cells(a, 1).EntireRow.Hidden = True
End If
Next a
End Sub


--
Regards,
Tom Ogilvy

"Alen32" wrote in message
lkaboutsoftware.com...
how to remove space?




Alen32

hide rows with macro
 
thanks!



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

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