In VB, how would the following look:
![]()
FOR all rows DO IF column(H) value in currentRow = "" THEN HIDE ROW ENDIF ENDFOR
In VB, how would the following look:
![]()
FOR all rows DO IF column(H) value in currentRow = "" THEN HIDE ROW ENDIF ENDFOR
If the values in H are true blanks (ie not formula nulls) then
![]()
Columns(8).SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
But I need a loop to go down a column and then hide each row that is blank in column H
Why do you "need to loop" - if you can avoid looping do so.
well say the excel file looks like this
Now at the click of a button if column H in a cell doesnt have an x (IE: its blank), will that code hide that row?![]()
A B C D H 1 3 5 6 x 1 3 5 6 1 3 5 6 x
...one way to find out...will that code hide that row?
it depends in part on how the x's are populated... are they manually inserted or result of formulae ?
yea they are inserted manually and yea that code works, Just as a add on is it possible to instead of typing, be able to click and it adds something, eg: check box, so I dont have to use the keyboard?
You mean to add the "X" ?
I would probably opt for a double-click event, ie:
The above would need to reside in the Sheet Object in VBE ... ie right click on tab against which the above is to be applied, select View Code and paste into resulting window.![]()
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) On Error GoTo ExitPoint If Target.Column <> 8 Or Target.Row = 1 Then Exit Sub Application.EnableEvents = False With Target: .Value = IIf(.Value = "X", "", "X"): End With ExitPoint: Application.EnableEvents = True Cancel = True End Sub
Yep that will do, cheers
If you are satisfied with the solution(s) provided, please mark your thread as Solved.
How to mark a thread Solved
Go to the first post
Click edit
Click Go Advanced
Just below the word Title you will see a dropdown with the word No prefix.
Change to Solved
Click Save
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks