I have two columns, Parent P/N and BOM P/N(child). What I need to do is find every relative that is associated with either the parent or child and Highlight them. I have attached a sample of the situation. Please not the one in red and follow it. It will show exactly what I mean.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
hyperlink parents. (excel 2000)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » hyperlink parents. (excel 2000)
- This topic has 56 replies, 4 voices, and was last updated 19 years, 2 months ago.
AuthorTopicWSvanoskyj
AskWoody LoungerFebruary 13, 2006 at 12:12 pm #429365Viewing 0 reply threadsAuthorReplies-
WSHansV
AskWoody LoungerFebruary 13, 2006 at 1:15 pm #999758Why not the one in red?
Try the following code. The first procedure is the macro to run.
Private lngMaxRow As Long
Sub Hilite()
If ActiveCell.Column > 1 Then
MsgBox “Please select a cell in column A.”, vbExclamation
Exit Sub
End If
lngMaxRow = Range(“A65536″).End(xlUp).Row
If ActiveCell.Row = 1 Or ActiveCell.Row > lngMaxRow Then
MsgBox ” Please select a cell within the range.”, vbExclamation
Exit Sub
End If
Range(“A2:B” & lngMaxRow).Font.ColorIndex = xlColorIndexAutomatic
HiliteMeAndKids ActiveCell
End SubSub HiliteMeAndKids(oCell As Range)
Dim i As Long
oCell.Resize(1, 2).Font.ColorIndex = 3
For i = 2 To lngMaxRow
If Range(“A” & i) = oCell.Offset(0, 1) Then
HiliteMeAndKids Range(“A” & i)
End If
Next i
End Sub -
WSvanoskyj
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSvanoskyj
AskWoody Lounger -
WSHansV
AskWoody LoungerFebruary 13, 2006 at 2:09 pm #999817Still not quite awake?
Try the following:
Private lngMaxRow As Long
Sub Hilite()
If ActiveCell.Column 2 Then
MsgBox “Please select a cell in column B.”, vbExclamation
Exit Sub
End If
lngMaxRow = Range(“A65536″).End(xlUp).Row
If ActiveCell.Row = 1 Or ActiveCell.Row > lngMaxRow Then
MsgBox ” Please select a cell within the range.”, vbExclamation
Exit Sub
End If
Range(“A2:B” & lngMaxRow).Font.ColorIndex = xlColorIndexAutomatic
HiliteMeAndSiblings ActiveCell
End SubSub HiliteMeAndSiblings(oCell As Range)
Dim i As Long
oCell.Offset(0, -1).Resize(1, 2).Font.ColorIndex = 3
For i = 2 To lngMaxRow
Debug.Print i
If Range(“A” & i) = oCell Then
HiliteMeAndSiblings Range(“B” & i)
End If
Next i
End Sub -
WSvanoskyj
AskWoody LoungerFebruary 14, 2006 at 8:56 pm #1000191Ok, I’m back among the living. Hans, My apologies for yesterday I really was not with it at all. Please let me explain again what I’m trying to do here.
The two columns are Column “H” and “I” what I’m trying to do is if the user clicks on a child in column “I”, I would like for them to be able to able to see any and all items that are associated with it. whether it be a parent or child. The same goes for if the user clicks on a cell in the parent column. Is there a way to have the user Hyperlink to the next listing of the same item or to have a msgbox appear that shows all the items both parent and child as well as the Job number COLUMN “F” show.
My main objective here is to make the user aware of any and all items associated with that particular Item as well as the job numbers.
-
WSvanoskyj
AskWoody LoungerFebruary 28, 2006 at 5:04 pm #1002356Hello, one and all.
I stated before that I did not understand what the instructions implied, Mainly because I did not understand what was expected.
I informed my teacher at school and he informed me that I need to review the book a little more, well I did and still don’t. Sometimes it just takes a while to click I guess.
What is expected: Column “I” is the part needed to create the Part in Column “H” but the part in column “H” could also be waiting on another part to be created in Column “I”. When all parts are in or have been created the Job can be released which means that the cell in column “B” turns Green.
if only a partial order has been met (Not all parts are there or they still need to be created) then cell in column “B” is yellow. Otherwise cell in column “B” is blue. I also need to know if a PO number Column “w” is holding up the process as well. last thing I’m trying to accomplish is a message box that tells the user what is keeping the job from being created.Not that easy HUH?
There it is folks. and no I do not want anybody to complete this for me. What I’m asking for a a little guidance. because if you complete it for me I will not be learning. Correct. Although I have been trying to break down what some the the programmers here are writing. Sometimes I understand it sometimes I dont. Thats when I ask for a simplier understanding of what a certain program does.
thank you Gentleman for Understanding and helping.
-
WSvanoskyj
AskWoody Lounger -
WSHansV
AskWoody LoungerFebruary 28, 2006 at 8:44 pm #1002401 -
WSvanoskyj
AskWoody LoungerMarch 1, 2006 at 12:15 pm #1002482I will try Hans, and thank you SOOOO much for getting back with me.
It works like this. Column “H” has all the part names within it. (A total of 233 parts). While Column “I” has Parts in it as well. Now lets say that we are trying to make a part number Called for the sake of Argument “PART D”. Part “D” would be found in Column H – but to build part D we need Parts A,B & C. Which would be found in Column I.
Now we Need to Make Part E, which also is in column H. But Part E is made up of parts A,B,C & D. which are found in column I and so on.
I need to be able to locate every reference of the Part number I’m looking for whether it be in column H or column I. If I click on a part number I should be able to notice all the other parts that are waiting on the part I need and to be able to see if a PO Number is holding it up. Thats exactly what the teacher said.
You see the main part that is found in column H can also be a smaller part (Column I) used to make another main part in column H.
Then I have to check Column W (the same row that the part is found on) to ensure it is blanks if not then I need to have a Popup message that states ” Part is waiting on PO Number (then the number that was found in that cell).
This one is very very Hard, It’s not easy going back and fourth from excel to vb to excel/vb together. I hope that helps – copied it down word for word.
My problem is I don’t really know the shortcuts in VB/Excel yet and keep wanting to use IF statements.
-
WSsdckapr
AskWoody Lounger -
WSvanoskyj
AskWoody LoungerMarch 1, 2006 at 1:20 pm #1002493Here is the spreedsheet info we were given.
If the parts are not available there would be a PO number in Column W.
What we are trying to accomplish is given the info in column H, I and W. The user needs to know what the part is being held up by – whether its another part thats waiting on something else or is that part waiting on something that was purchased (PO Number). And they need to be able to see it clearly. So I suggested a Message box and he said that was ok.
-
WSsdckapr
AskWoody LoungerMarch 1, 2006 at 3:08 pm #1002519If this is class assignment shouldn’t you be doing this on your own? If we tell you how to do this, how does this help you learn? I suppose we can offer some suggestions and let you do the work.
It is still not clear to me what you want and need. The last few descriptions have dealt with H, I, and W. How do A, B, C, D, E, and X work into it? Also why are some of the items in col A blank? and why do none of the columns have descriptive labels?
Can you give some examples, based on this sample, of what you want the workbook to do?
Steve
-
WSvanoskyj
AskWoody LoungerMarch 1, 2006 at 6:39 pm #1002577That’s exactly what I’m looking for. Thats the reason why I have not been spelling it out directly to everybody so that I can monkey around with what you think I should do and try to figure it out on my own. As for the other columns They are being used by other data as well It’s just that that data does not matter in the equation.
Right now I have it set up so that if a part in column “I” is selected any parents it belongs that are associated with it in any way are highlighted. (Thanks to Hans, and a little tweaking). I’m hoping that some how I can set it up to include the PO Number (COLUMN W) within the equation and the give a message to the user stating ” The part you are looking for is waiting on part number……whatever, or a PO Number … But I’m not sure how to go about doing that.
Please review the attachment and look at column “I” row 21 you will see number PR-05399
If you now look at Column “H” row 18 you will see it’s parent. but that parent is waiting on another part CNB42.079X6-G.
I would also need to check Column W (Po #) to see if it’s waiting on a purchased part or not.I have my code listed below but it works on every column. By that I mean If I click on a cell in column b anything in column A that resembles it would be hilited as well. I only want this to work on columns H and I.
Plus How do I go about creatinmg the pop up message if the main parent is waiting on a PO # or another part.
I’m Lost totally… And the teacher has already said he will not assist. This has to be done by the end of spring break in two weeks.
Private lngMaxRow As Long
Private Sub EXEC_BTN_Click()
lngMaxRow = Range(“I65536”).End(xlUp).Row
Range(“H2:I” & lngMaxRow).Font.ColorIndex = xlColorIndexAutomatic
HiliteMeAndSiblings ActiveCell
End SubSub HiliteMeAndSiblings(oCell As Range)
Dim i As Long
oCell.Offset(0, -1).Resize(1, 2).Font.ColorIndex = 5
For i = 2 To lngMaxRow
Debug.Print i
If Range(“H” & i) = oCell Then
HiliteMeAndSiblings Range(“I” & i)
End If
Next i
End Sub -
WSvanoskyj
AskWoody Lounger -
WSsdckapr
AskWoody Lounger -
WSvanoskyj
AskWoody Lounger -
WSsdckapr
AskWoody LoungerMarch 2, 2006 at 6:06 pm #1002732Yes the code can be modified to do that, as I described before. You have code to find them all, it just needs tweaking to do something other than highlighting them.
but once the rows are hidden. you will need a button to unhide them all so you can select a different one and run the code.
Steve
-
WSvanoskyj
AskWoody LoungerMarch 6, 2006 at 12:26 pm #1003201Ok, I spent most of my weekend looking through the book, It does not state anywhere what kind of code I need to use to have the rows hide or unhide. Besides doing it manually. What I’m looking for is when the Parent and Children are all selected I need only those rows to appear. and when the user clicks on them again all rows appear again. I need help on this anybody. Please.
-
WSsdckapr
AskWoody LoungerMarch 6, 2006 at 12:47 pm #1003207This will hide all the rows in the range
Range(“H4:I” & lngMaxRow).EntireRow.Hidden = TrueThis will unhide all the rows
Range(“H4:I” & lngMaxRow).EntireRow.Hidden = FalseThis line in “HiliteMeAndSiblings” will unhide the “matching row” rather than coloring it:
oCell.Offset(0, -1).EntireRow.Hidden = FalseYou can run the code to hide all rows, then have it go thru the “HiliteMeAndSiblings” (you could change the name to HideMeAndSiblings” if desired).
Then have a button to unhide all the rows so you can select a new cell and then run the routine to hide based on that one.
Steve
-
WSvanoskyj
AskWoody LoungerMarch 6, 2006 at 1:06 pm #1003212So where would I place them at in my code. I tried and got an error saying subscript out of range.
Private lngMaxRow As Long
Private Sub EXEC_BTN_Click()
lngMaxRow = Range(“I65536”).End(xlUp).Row
Range(“H2:I” & lngMaxRow).Font.ColorIndex = xlColorIndexAutomatic
HiliteMeAndSiblings ActiveCell
End SubSub HiliteMeAndSiblings(oCell As Range)
Dim i As Long
oCell.Offset(0, -1).Resize(1, 2).Font.ColorIndex = 5
For i = 2 To lngMaxRow
Debug.Print i
If Range(“H” & i) = oCell Then
HiliteMeAndSiblings Range(“I” & i)
End If
Next i
End Sub -
WSvanoskyj
AskWoody LoungerMarch 6, 2006 at 1:12 pm #1003213 -
WSvanoskyj
AskWoody Lounger -
WSsdckapr
AskWoody LoungerMarch 6, 2006 at 2:41 pm #1003230Where did you put the lines of code and what did you use?
You can have them replace the lines which currently color.
I would first unhide all the rows then check the “lastrow”. If the selection is not in H or I or is blank I would just unhide all and not hide anything (running with a “blank cell” is then used to display all). If it is in H/I and not blank then it hide all, and run the unhide routine.
To speed it up, instead of doing each unhiding separately, you might want to create “unhide range” object making each new row UNION to the current range (expanding it as you go). Then just unhide this range object all at once.
Steve
-
WSvanoskyj
AskWoody Lounger -
WSvanoskyj
AskWoody LoungerMarch 6, 2006 at 3:01 pm #1003235This is what I have so far.
Private lngMaxRow As LongPrivate Sub EXEC_BTN_Click()
lngMaxRow = Range(“I65536”).End(xlUp).Row
Range(“H2:I” & lngMaxRow).Font.ColorIndex = xlColorIndexAutomatic
HiliteMeAndSiblings ActiveCell
End SubSub HiliteMeAndSiblings(oCell As Range)
Range(“H4:I” & lngMaxRow).EntireRow.Hidden = TrueDim i As Long
‘oCell.Offset(0, -1).Resize(1, 2).Font.ColorIndex = 5
oCell.Offset(0, -1).EntireRow.Hidden = False
For i = 2 To lngMaxRow
Debug.Print i
If Range(“H” & i) = oCell Then
Range(“I” & i).EntireRow.Hidden = False
End If
Next i
End Sub -
WSvanoskyj
AskWoody LoungerMarch 6, 2006 at 3:22 pm #1003243 -
WSsdckapr
AskWoody LoungerMarch 6, 2006 at 3:32 pm #1003247(Edited by sdckapr on 06-Mar-06 11:32. Added PS)
As I mentioned in post 561,255:
[indent]
I would first unhide all the rows then check the “lastrow”. If the selection is not in H or I or is blank I would just unhide all and not hide anything (running with a “blank cell” is then used to display all). If it is in H/I and not blank then it hide all, and run the unhide routine.
[/indent]
Unhide in the “click routine”, get the lastrow. If the intersection of activecell and columns H/I is something and the activecell is not blank, then hide all the rows and run the hiliteme with the activecell
Steve
PS. you could also do it using the “selection” event instead of your “click routine”. Unhide all rows with each selection, but if you select a cell in H/I with something in it, hide all and unhide with “hiliteme”.
-
WSvanoskyj
AskWoody Lounger -
WSvanoskyj
AskWoody Lounger -
WSsdckapr
AskWoody LoungerMarch 6, 2006 at 4:52 pm #1003264As mentioned bring back all the rows first:
Private Sub EXEC_BTN_click()
Range(“H4:H65536”).EntireRow.Hidden = False
lngMaxRow = Range(“I65536”).End(xlUp).RowThen check the contents of the activecell and its location (use INTERSECT). if it is not blank and in col H/I then hide all the rows and run “hilitieMe” with the activecell (hiliteme will unhide the appropriate rows)
Steve
-
WSvanoskyj
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSvanoskyj
AskWoody Lounger -
WSvanoskyj
AskWoody Lounger -
WSvanoskyj
AskWoody Lounger -
WSsdckapr
AskWoody Lounger -
WSvanoskyj
AskWoody LoungerMarch 6, 2006 at 7:36 pm #1003296thanks steve, I thought you left for the day.
Private lngMaxRow As Long
Private Sub EXEC_BTN_Click()
HiliteMeAndSiblings ActiveCell
End SubSub HiliteMeAndSiblings(oCell As Range)
lngMaxRow = Range(“I1000”).End(xlUp).RowDim i As Long
‘oCell.Offset(0, -1).Resize(1, 2).Font.ColorIndex = 5
oCell.Offset(0, -1).EntireRow.Hidden = False
For i = 9 To lngMaxRow
Debug.Print i
If ActiveCell “” Then
Range(“H5:I” & lngMaxRow).EntireRow.Hidden = True
End If
If Range(“H” & i) = oCell Then
Range(“I” & i).EntireRow.Hidden = False
End If
Next iEnd Sub
Private Sub CommandButton1_Click()
With Sheet1
ActiveWorkbook.RefreshAll
End With
End Sub -
WSvanoskyj
AskWoody Lounger -
WSsdckapr
AskWoody LoungerMarch 6, 2006 at 8:03 pm #1003300You have made some major changes to it and the logic is not correct
The original code Hans wrote should be the start. It was only changing the autocolor line in the click code to “hideall” and the offset color line in Hilite me to “hide the row”. Then an unhide all was added before checking for the maxrow in Click .
Hans’ code colored/uncolored the cells. You only need to modify it to hide/unhide (you will also need a trigger to unhide all, which I suggest is when the activecell is blank or not in H/I. This can be added in an IF in the click code (you would only hideall and run hiliteme if the activecell is not blank and was in Col H/I).
Why did you delete the recursive “Hiliteme” code in “hilitleme”? You need this in the code to keep looking for the parents/siblings.
Why do you have all the hiding and unhiding in the “HiliteMe” code? We talked about this one before.
There should be only 1 unhide in the hiliteme code for when it finds a match (the Offset line)
As stated previously the unhide all the rows should be the first line of CLICK code. The in the click code check the rows.
Then (in an IF if you want to check for blank and cols H/I)
hide all the rows form line 4 to lastrow
Then (also in the if) run the Hiliteme code.If you unhide or hide other rows (other than the “matching” ones), you will not get it to work.
Steve
-
WSvanoskyj
AskWoody LoungerMarch 7, 2006 at 12:23 pm #1003428Sorry Steve, I was trying some things out of the book.
I have repaired it. This is what I have so Far.
Private Sub CommandButton1_Click()
With Sheet1
ActiveWorkbook.RefreshAll
End With
End SubPrivate Sub EXEC_BTN_click()
Range(“H4:H1000”).EntireRow.Hidden = False
lngMaxRow = Range(“I1000”).End(xlUp).Row
lorIndex = xlColorIndexAutomatic
HiliteMeAndSiblings ActiveCell
End SubSub HiliteMeAndSiblings(oCell As Range)
Application.ScreenUpdating = False
Range(“H4:I” & lngMaxRow).EntireRow.Hidden = TrueDim i As Long
‘oCell.Offset(0, -1).Resize(1, 2).Font.ColorIndex = 5
oCell.Offset(0, -1).EntireRow.Hidden = False
For i = 2 To lngMaxRow
Debug.Print i
If Range(“H” & i) = oCell Then
Range(“I” & i).EntireRow.Hidden = False
End If
Next i
Application.ScreenUpdating = True
End SubTell me Steve what would your code look like. I really do not want to fail this. But I’m just so confused between the VB books the Excel Books and what people are telling me how it should look and work. AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!! Real Life Programming can’t be this way, can it?
-
WSsdckapr
AskWoody LoungerMarch 7, 2006 at 12:46 pm #1003436Why do you only go to row 1000? will the workbook never have more than 1000 rows of data? I would use 65536. It should not affect the speed of your code.
What is this line for?
lorIndex = xlColorIndexAutomaticThe hide all rows (as mentioned before) goes in the click event, You still have it in the “hiltieme” routine. I thought you wanted to check for blank cells before hiding all and running the “hiliteme” You do not have that code in it
I would put the screenupdating in the click event not the “hiliteme” as I mentioned before there is not need to switch it on/off dozens of times while the code runs and searches for parents/siblings. The one time in the click event start to turn off and turn it back on when the all done is sufficient.
What is the purpose of your “debug.print line” this will slow your code listing all the “matches” into the immediate pane.
If you had followed my suggestions you would have close to my code. I am reluctant to post my code, since you have not seen to even grasp the original code that Hans posted. As I stated earlier, I am not here to do your homework, my goal is to help and offer suggestions.
i am not sure Hans would have even posted that code, if he had known that he was doing homework for you. The effort on your end needs to be done to understand what the code is doing. Did you even once step thru the original code to see what it was doing so you could understand how it worked and what it did? It seems that you do not understand at all even the initial code based on how you continue to try to modify it.
I also do not know what the “commandbutton1_Click” code is for. It does not seem necessary.
I suggest you start back with hiliteme code as originally written, step thru it so you understand what it is doing. Once you understand it, read thru the posts again to understand what has been suggested and follow the directions/suggestions. Once you have grasped the original code the suggestions should make more sense and you can then ask more specific questions on your specific problems.
Steve
-
WSvanoskyj
AskWoody LoungerMarch 7, 2006 at 1:29 pm #1003447I told you I was a newbie….. I really suck at this thats why I’m going to school for it to hopefully get better. I really do appreciate you patience as well as your knowledge. thank you.
1). I only have 831 rows of data, I thought it would make it go faster if it did not read all the blank cells.
2). the “lorIndex = xlColorIndexAutomatic” was just a left over line from what Hans gave me I have since taken it out.
3). I have put the Hide all rows within the click event. along with the if statement.
4). I have put the screen updating within the click event as well.
5). The debug print line has been taken out. As I stated earlier I was reading from the book.
6). Hans’ code allowed me to hilite anything within columns H and I (parent and child) It looked through the whole column and if it found it it would hilight it.
Yes I agree there are some parts of this coding that is way over my head. That is the reason I ask these stupid questions. My teacher keeps telling us that in the real world people search out the answers rather through the Internet or books. I have tried to do both. It just gets so confusing day after day trying to understand what he wants out of us and what the book states to do and what the people on line tell me what to do. I really do appreciate both you and Hans for you superior Knowledge (and no I’m not a** kissing) Its true. I have stated before in the past that I have tried other sites but they are filled with Newbies like myself who really do not know what the hell they are talking about. Thats why I kep coming here. I bought the excel 2000 book and it gave me this site for reference. If I have become a Nuisance please say so and I will stop. thank you for your time and all of your efforts. -
WSvanoskyj
AskWoody LoungerMarch 7, 2006 at 1:30 pm #1003448Also I have reviewed the Intersect on vba help. dont really understand how that would help. what can I say I’m an Idiot.
Returns a Range object that represents the rectangular intersection of two or more ranges.
expression.Intersect(Arg1, Arg2, …)
expression Optional. An expression that returns an Application object.
Arg1, Arg2, … Required Range. The intersecting ranges. At least two Range objects must be specified.
Example
This example selects the intersection of two named ranges, rg1 and rg2, on Sheet1. If the ranges don’t intersect, the example displays a message.Worksheets(“Sheet1”).Activate
Set isect = Application.Intersect(Range(“rg1”), Range(“rg2”))
If isect Is Nothing Then
MsgBox “Ranges do not intersect”
Else
isect.Select
End IfMy new code is below:
Private lngMaxRow As Long
Private Sub EXEC_BTN_click()
Application.ScreenUpdating = False
Range(“H4:H65536”).EntireRow.Hidden = False
lngMaxRow = Range(“I65536”).End(xlUp).RowIf ActiveCell “” Then
Range(“H4:I” & lngMaxRow).EntireRow.Hidden = TrueHiliteMeAndSiblings ActiveCell
End If
Application.ScreenUpdating = TrueEnd Sub
Sub HiliteMeAndSiblings(oCell As Range)
Dim i As Long
oCell.Offset(0, -1).EntireRow.Hidden = False
For i = 2 To lngMaxRow
Debug.Print i
If Range(“H” & i) = oCell Then
Range(“I” & i).EntireRow.Hidden = False And Range(“H” & i).EntireRow.Hidden = False
End If
Next iEnd Sub
Private Sub CommandButton1_Click()
With Sheet1
ActiveWorkbook.RefreshAll
End With
End Subthank you gentlemen.
-
WSvanoskyj
AskWoody Lounger -
WSJezza
AskWoody LoungerMarch 7, 2006 at 3:28 pm #1003488Remember some of us are in different time zones and from all over the world. Steve and the others have provided a substantial amount of their time assisting you with this homework of yours. The majority of us are at work or popping into the Lounge after a long days work ans cannot specifically assist you as there are other Loungers too.
Please be patient.
-
WSvanoskyj
AskWoody Lounger -
WSvanoskyj
AskWoody LoungerMarch 7, 2006 at 4:19 pm #1003499ok, I finally have it working where it finds everything needed except. If the cell conatins PSA-100 it finds everything that mayches it exactly. What about wildcards. How can I not only find the PSA-100’s but also the PSA-100-6 & PSA-100-msa & PSA-100klu Etc… after this I should be done.
Current code below:
rivate lngMaxRow As Long
Private Sub CommandButton1_Click()
With Sheet1
ActiveWorkbook.RefreshAll
End With
End SubPrivate Sub EXEC_BTN_click()
Application.ScreenUpdating = FalseRange(“H6:H65536”).EntireRow.Hidden = False
lngMaxRow = Range(“I65536”).End(xlUp).RowIf IsEmpty(ActiveCell) = False Then
‘ActiveCell has something in it.
If ActiveCell.Column = 8 Or ActiveCell.Column = 9 Then
‘ActiveCell is in Column H or I.
Range(“H6:I” & lngMaxRow).EntireRow.Hidden = True
End If
End IfHiliteMeAndSiblings ActiveCell
Application.ScreenUpdating = True
End Sub
Sub HiliteMeAndSiblings(oCell As Range)
Dim i As Long
‘oCell.Offset(0, -1).Resize(1, 2).Font.ColorIndex = 5
oCell.Offset(0, -1).EntireRow.Hidden = False
For i = 2 To lngMaxRow
Debug.Print i
If Range(“H” & i) = oCell & “*” Then
Range(“I” & i).EntireRow.Hidden = False
End If
Next i
HiliteMeAndSiblings2 ActiveCellEnd Sub
Sub HiliteMeAndSiblings2(oCell As Range)
Dim i As Long
‘oCell.Offset(0, -1).Resize(1, 2).Font.ColorIndex = 5
oCell.Offset(0, 1).EntireRow.Hidden = False
For i = 2 To lngMaxRow
Debug.Print i
If Range(“I” & i) = oCell Then
Range(“H” & i).EntireRow.Hidden = False
End If
Next iEnd Sub
-
WSHansV
AskWoody Lounger -
WSsdckapr
AskWoody Lounger -
WSvanoskyj
AskWoody LoungerMarch 7, 2006 at 6:17 pm #1003525 -
WSsdckapr
AskWoody LoungerMarch 7, 2006 at 7:12 pm #10035291) This has already been mentioned before. Instead of unhiding them all at once, use a range variable to hold all the rows to hide. Keep UNIONing the row that matches to the rows that already matched. then unhide this range all at once. That may speed it up.
Additionally, instead of looping thru the range in VB and comparing it row by row, use FIND to loop thru all the cells and mark them. This may be faster also.
You can test to see which one will have greater impact by comparing the hide/undhide scenario, versus a code which only finds and colors the appropriate cells. If the one that colors is much faster it is not a searching issue by an unhiding issue.
It may even be simpler codiing to mark the rows that should be visible with an “x” in a blank column as you go thru the code. the add the end just use autofilter to filter on the “X”.
2) My code is just some minor modifications of Hans’ code as I mentioned before: he highlighted, I hid. The major change unhiding all to start and checking for a blank cell or not in H/I to unhide all.
Option Explicit Private lngMaxRow As Long Sub EXEC_BTN_Click() Range("H4:H65536").EntireRow.Hidden = False lngMaxRow = Range("I65536").End(xlUp).Row If Not Intersect(ActiveCell, Range("H:I")) Is Nothing And _ ActiveCell "" Then Range("H4:I" & lngMaxRow).EntireRow.Hidden = True HiliteMeAndSiblings ActiveCell End If End Sub Sub HiliteMeAndSiblings(oCell As Range) Dim i As Long oCell.Offset(0, -1).EntireRow.Hidden = False For i = 2 To lngMaxRow If Range("H" & i) = oCell Then HiliteMeAndSiblings Range("I" & i) End If Next i End Sub
Steve
-
WSHansV
AskWoody Lounger -
WSsdckapr
AskWoody LoungerMarch 6, 2006 at 7:24 pm #1003293I am still around.
The code unhides all the rows this is not slow. You should only be going to the lastrow of your data.
It must go thru each row in your range 1 row at a time to unhide the appropriate ones. This can be sped up 2 ways. Add:
Application.ScreenUpdating = Falseat the front of the “Click:” code and add:
Application.ScreenUpdating = True
Ad the end of the click code. This will stop XL from redrawing the screen until the code is complete. this will help a little.The 2nd way is, as mentioned earlier, not to unhide row by row. UNION all the ranges together first and then Unhide the UNIONed range. UNION is VB method and you can read about it in HELP.
Steve
-
WSsdckapr
AskWoody LoungerMarch 6, 2006 at 3:26 pm #1003245Your “hiding all rows” should be in the “click routine” not the “HiliteMe” routine. You are unhiding the rows that match, then when you look for others you are hiding all again…
The “hide all” line replaces the “uncolor line” in the “click”. The click routine is also where you could check that the activecell had something in it and was within column H/I (HINT: read about the “Intersect” routine in VB Help. You could also search the postings here for code with intersect which tests for the activecell being in a range).
Steve
-
WSsdckapr
AskWoody LoungerMarch 1, 2006 at 8:32 pm #1002602I am still confused at what you want/need.
If you do not want the code to run when you are on column B then do not run it, only run it when you are the column you want to check. you could, if desired, have the code check the column you are on and only run for certain columns.
A msgbox command can pop up messages (see VB help for more details).
If you want specific answers to specific questions you need to detail what you need help with.
Steve
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Windows 11 Insider Preview build 27863 released to Canary
by
joep517
1 hour, 38 minutes ago -
Windows 11 Insider Preview build 26120.4161 (24H2) released to BETA
by
joep517
1 hour, 39 minutes ago -
AI model turns to blackmail when engineers try to take it offline
by
Cybertooth
1 hour, 44 minutes ago -
Migrate off MS365 to Apple Products
by
dmt_3904
2 hours, 15 minutes ago -
Login screen icon
by
CWBillow
9 hours, 50 minutes ago -
AI coming to everything
by
Susan Bradley
1 hour, 49 minutes ago -
Mozilla : Pocket shuts down July 8, 2025, Fakespot shuts down on July 1, 2025
by
Alex5723
17 hours, 18 minutes ago -
No Screen TurnOff???
by
CWBillow
17 hours, 40 minutes ago -
Identify a dynamic range to then be used in another formula
by
BigDaddy07
18 hours, 13 minutes ago -
InfoStealer Malware Data Breach Exposed 184 Million Logins and Passwords
by
Alex5723
1 day, 5 hours ago -
How well does your browser block trackers?
by
n0ads
16 hours, 7 minutes ago -
You can’t handle me
by
Susan Bradley
3 hours, 39 minutes ago -
Chrome Can Now Change Your Weak Passwords for You
by
Alex5723
8 hours, 44 minutes ago -
Microsoft: Over 394,000 Windows PCs infected by Lumma malware, affects Chrome..
by
Alex5723
1 day, 17 hours ago -
Signal vs Microsoft’s Recall ; By Default, Signal Doesn’t Recall
by
Alex5723
20 hours, 41 minutes ago -
Internet Archive : This is where all of The Internet is stored
by
Alex5723
1 day, 17 hours ago -
iPhone 7 Plus and the iPhone 8 on Vantage list
by
Alex5723
1 day, 17 hours ago -
Lumma malware takedown
by
EyesOnWindows
1 day, 5 hours ago -
“kill switches” found in Chinese made power inverters
by
Alex5723
2 days, 2 hours ago -
Windows 11 – InControl vs pausing Windows updates
by
Kathy Stevens
2 days, 2 hours ago -
Meet Gemini in Chrome
by
Alex5723
2 days, 6 hours ago -
DuckDuckGo’s Duck.ai added GPT-4o mini
by
Alex5723
2 days, 6 hours ago -
Trump signs Take It Down Act
by
Alex5723
2 days, 14 hours ago -
Do you have a maintenance window?
by
Susan Bradley
19 hours, 16 minutes ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
1 day, 16 hours ago -
Cox Communications and Charter Communications to merge
by
not so anon
2 days, 17 hours ago -
Help with WD usb driver on Windows 11
by
Tex265
5 hours, 5 minutes ago -
hibernate activation
by
e_belmont
3 days, 2 hours ago -
Red Hat Enterprise Linux 10 with AI assistant
by
Alex5723
3 days, 6 hours ago -
Windows 11 Insider Preview build 26200.5603 released to DEV
by
joep517
3 days, 9 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.