• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Unhide row on the value based in cell G7, value is between 1 to 10

ThrottleWorks

Excel Ninja
Hi,


Could somebody please help me in the below code


I have a value in cell G7, the value is number between 1 to 10.


I have allready hidden rows 11 to 23.

I want to unhide 11 to 23 based on the value in cell G7.


for example G7 cell has value 5 then rows 11 to 16 will get unhide.


Can someone help me in this please.


I am using following code at prsent.


Sub UnHideSubmitButton()


'unhide submit button


Worksheets("view").Select

Rows("23:25").Select

Selection.EntireRow.Hidden = False


MyTblVl = Range("g7")

i = MyTblVl


Rows("11:i").Select

Selection.EntireRow.Hidden = False


End Sub
 
Hi

Use this code (writen in the module of the worksheet). It uses the event Change (ie, if the value of G7 changes, the code will be run automtically)


You can adapte the row numbers

[pre]
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Application.ScreenUpdating = False
If Target.Address = "$G$7" Then
Rows("11:23").Hidden = True
Rows("11:" & 11 + Val(Target.Value)).Hidden = False
End If
End Sub
[/pre]
 
Back
Top