PC Review Forums Software Windows XP & Applications Using the VB activate event in Excel

Reply
 
Thread Tools Rate Thread
Old 31-03-2008, 04:46 PM   #1
arukas03
Junior Member
 
Join Date: Mar 2008
Posts: 1
Trader Rating: (0)
Default Using the VB activate event in Excel

Hi,
I am looking for some help in coding a simple function for a scoring program i have written in excel. The goal of the function is to hide rows/columns that contain data entry areas and display areas that arent being used. It works by testing for the presence of a participants name and then declaring the cells as hidden true or false.

The code i have currently does this job perfectly, the problem is that it does it using SelectionChange. Given the nature of the page it is on is data entry, a selection change occurs often and it is very annoying to have the page refresh all the time. My goal is to have it run using the activate event or the follow hyperlink event. I have tried for several hours to figure it out myself but i don't have a very good handle on VB. Any help would be appreciated.

Regards
Tom

The sheet users navigate from to get to the data entry page is called TitlePage.
The data entry page is called JudgesScores.

The current code is as follows:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If (Worksheets("TitlePage").Range("I15") = "") Then
Worksheets("JudgesScores").Rows("2:12").Hidden = True
Else
Worksheets("JudgesScores").Rows("2:12").Hidden = False
End If
If (Worksheets("TitlePage").Range("I17") = "") Then
Worksheets("JudgesScores").Rows("13:23").Hidden = True
Else
Worksheets("JudgesScores").Rows("13:23").Hidden = False
End If
If (Worksheets("TitlePage").Range("I19") = "") Then
Worksheets("JudgesScores").Rows("24:34").Hidden = True
Else
Worksheets("JudgesScores").Rows("24:34").Hidden = False
End If
If (Worksheets("TitlePage").Range("I21") = "") Then
Worksheets("JudgesScores").Rows("35:45").Hidden = True
Else
Worksheets("JudgesScores").Rows("35:45").Hidden = False
End If
If (Worksheets("TitlePage").Range("I23") = "") Then
Worksheets("JudgesScores").Rows("46:56").Hidden = True
Else
Worksheets("JudgesScores").Rows("46:56").Hidden = False
End If
If (Worksheets("TitlePage").Range("I25") = "") Then
Worksheets("JudgesScores").Rows("57:67").Hidden = True
Else
Worksheets("JudgesScores").Rows("57:67").Hidden = False
End If
If (Worksheets("TitlePage").Range("I27") = "") Then
Worksheets("JudgesScores").Rows("68:78").Hidden = True
Else
Worksheets("JudgesScores").Rows("68:78").Hidden = False
End If
If (Worksheets("TitlePage").Range("I29") = "") Then
Worksheets("JudgesScores").Rows("79:89").Hidden = True
Else
Worksheets("JudgesScores").Rows("79:89").Hidden = False
End If
If (Worksheets("TitlePage").Range("I31") = "") Then
Worksheets("JudgesScores").Rows("90:100").Hidden = True
Else
Worksheets("JudgesScores").Rows("90:100").Hidden = False
End If
If (Worksheets("TitlePage").Range("I33") = "") Then
Worksheets("JudgesScores").Rows("101:111").Hidden = True
Else
Worksheets("JudgesScores").Rows("101:111").Hidden = False
End If
End Sub
arukas03 is offline   Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off