[vba excel] macro to hide row
Vince7338
Posted messages
1
Status
Member
-
Jacquou -
Jacquou -
Hello everyone,
I have a problem with a VBA macro in Excel (I specify that I don't know much!!! I just know how to use macros but not create them!!!)
So, I have a table of the type:
''''''''''''''''''''''A''''''''''''''''''''''''''''''''''''''B'''''''''''''''''''''''''''''C''''''''''''''''''''''''''''''''''''''D
1
2
3
4
5'''''''''Equipments'''''''''''''Domains'''''''''''''''Impact '''''''''''''''''''Action to take
6''''''''Compactor''''''''''''''''''''Air''''''''''''''''''''Dust''''''''''Do analysis by lab
7'''''''''''''''Tour
8'''''Welding station
9'''''''''''''''Oven''''''''''''''''''''''''''''''''Air'''''''''''''''''''''''Smoke''''''''''''''Do analysis by lab
I would like to have a button (macro) to obtain the following table format to facilitate printing because my table is very large:
''''''''''''''''''''''A''''''''''''''''''''''''''''''''''''''B'''''''''''''''''''''''''''''C''''''''''''''''''''''''''''''''''''''D
1
2
3
4
5'''''''''Equipments'''''''''''''Domains'''''''''''''''Impact '''''''''''''''''''Action to take
6''''''''Compactor''''''''''''''''''''Air''''''''''''''''''''Dust''''''''''Do analysis by lab
9'''''''''''''''Oven''''''''''''''''''''''''''''''''Air'''''''''''''''''''''''Smoke''''''''''''''Do analysis by lab
So the condition is: if there is no impact (empty cell in column C), the entire row should be hidden. Then, I would need a second button to make the hidden rows reappear. I want the first 4 rows to remain because they contain my company's logo + document update date, etc.
Thank you in advance
Vince
I have a problem with a VBA macro in Excel (I specify that I don't know much!!! I just know how to use macros but not create them!!!)
So, I have a table of the type:
''''''''''''''''''''''A''''''''''''''''''''''''''''''''''''''B'''''''''''''''''''''''''''''C''''''''''''''''''''''''''''''''''''''D
1
2
3
4
5'''''''''Equipments'''''''''''''Domains'''''''''''''''Impact '''''''''''''''''''Action to take
6''''''''Compactor''''''''''''''''''''Air''''''''''''''''''''Dust''''''''''Do analysis by lab
7'''''''''''''''Tour
8'''''Welding station
9'''''''''''''''Oven''''''''''''''''''''''''''''''''Air'''''''''''''''''''''''Smoke''''''''''''''Do analysis by lab
I would like to have a button (macro) to obtain the following table format to facilitate printing because my table is very large:
''''''''''''''''''''''A''''''''''''''''''''''''''''''''''''''B'''''''''''''''''''''''''''''C''''''''''''''''''''''''''''''''''''''D
1
2
3
4
5'''''''''Equipments'''''''''''''Domains'''''''''''''''Impact '''''''''''''''''''Action to take
6''''''''Compactor''''''''''''''''''''Air''''''''''''''''''''Dust''''''''''Do analysis by lab
9'''''''''''''''Oven''''''''''''''''''''''''''''''''Air'''''''''''''''''''''''Smoke''''''''''''''Do analysis by lab
So the condition is: if there is no impact (empty cell in column C), the entire row should be hidden. Then, I would need a second button to make the hidden rows reappear. I want the first 4 rows to remain because they contain my company's logo + document update date, etc.
Thank you in advance
Vince
Configuration: Windows XP Firefox 2.0.0.5
4 answers
-
Alright, I'm going to try to give you a solution
------
TO HIDE
----------
Sub hide()
Range("B1:B7").Select 'B1:B7 corresponds to the range of cells you want to check
For Each o In Selection
If o.Value = "" Then
o.EntireRow.Hidden = True
End If
Next
End Sub
-----------------------------------------------------
TO SHOW YOUR CELLS
-----------
Sub unhide()
Range("B1:B7").Select
Selection.EntireRow.Hidden = False
End Sub
------------------------------------------------
And then you go to Excel...Tools/Macro/Run a macro..
Magic magic you discover two macros (Hide and Unhide)
Then you can add buttons to your Excel sheet and when you click on them, it runs the macros.
DISPLAY / TOOLBAR / FORM
You select the button
Place it on your sheet and select the right macro to assign..
BYE....Looking forward to it