ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   BeforeDoubleClick processing question(s) (https://www.excelbanter.com/excel-programming/376954-beforedoubleclick-processing-question-s.html)

Forms / Send to .....VBA or Macro?

BeforeDoubleClick processing question(s)
 
I am new to vba and excel and would like to use a double click to hide or
unhide rows if the color is white. Question: once I get it working (see
below) will the hidden rows automatically be excluded from further
processing? I believe the vba for this is correctly sitting in the excel
objects area for the active sheet.

The syntax of most things in vba still baffle me. D1 is the click-to-hide
cell. D2 is to unhide.

Dim cell As Range

Private Hiderows()
SheetName_Beforedoubleclick (D1)
For Each cell In Range("S5:S300")
cell.EntireRow.Hidden = cell.Interior.ColorValue = xlNone
Next cell
End Sub

Private Showrows()
SheetName_Beforedoubleclick (D2)
cell.EntireRow.Hidden = False
End Sub

Don Guillett

BeforeDoubleClick processing question(s)
 

You may find this to be a bit easier. If hidden, will unhide. If not, will
hide

Sub togglehide()
Rows("2:10").Hidden = Not Rows("2:10").Hidden
End Sub

--
Don Guillett
SalesAid Software

" Forms / Send to .....VBA or Macro?"
wrote in message
...
I am new to vba and excel and would like to use a double click to hide or
unhide rows if the color is white. Question: once I get it working (see
below) will the hidden rows automatically be excluded from further
processing? I believe the vba for this is correctly sitting in the excel
objects area for the active sheet.

The syntax of most things in vba still baffle me. D1 is the click-to-hide
cell. D2 is to unhide.

Dim cell As Range

Private Hiderows()
SheetName_Beforedoubleclick (D1)
For Each cell In Range("S5:S300")
cell.EntireRow.Hidden = cell.Interior.ColorValue = xlNone
Next cell
End Sub

Private Showrows()
SheetName_Beforedoubleclick (D2)
cell.EntireRow.Hidden = False
End Sub




JLGWhiz

BeforeDoubleClick processing question(s)
 
The D1 code looks a little flawed, like maybe you ran something together.
Maybe it should be:

Private Sub Worksheet_Beforedoubleclick (D1)
For Each cell In Range("S5:S300")
cell.Interior.ColorIndex = xlNone
cell.EntireRow.Hidden = True
Next cell
End Sub

I haven't tried this but, I thought it might point you in the right
direction. Check out the hidden property in VBA Help. Also see the
BeforeDoubleClick method in VBA Help. You can access VBA Help by pressing
Alt+F11 to open the VB Editor. Good luck.



" Forms / Send to .....VBA or Macro?" wrote:

I am new to vba and excel and would like to use a double click to hide or
unhide rows if the color is white. Question: once I get it working (see
below) will the hidden rows automatically be excluded from further
processing? I believe the vba for this is correctly sitting in the excel
objects area for the active sheet.

The syntax of most things in vba still baffle me. D1 is the click-to-hide
cell. D2 is to unhide.

Dim cell As Range

Private Hiderows()
SheetName_Beforedoubleclick (D1)
For Each cell In Range("S5:S300")
cell.EntireRow.Hidden = cell.Interior.ColorValue = xlNone
Next cell
End Sub

Private Showrows()
SheetName_Beforedoubleclick (D2)
cell.EntireRow.Hidden = False
End Sub



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

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