-
WSmikerickson
AskWoody LoungerYou could use the .OnKey method
Sub AssignUp_DownKeys() Application.OnKey "{down}", "IncrimentFormsListBoxSelection" Application.OnKey "{up}", "DecrimentFormsListBoxSelection" End Sub Sub IncrimentFormsListBoxSelection() With Sheets("Sheet1").Shapes("List Box 1").ControlFormat .ListIndex = ((.ListIndex) Mod .ListCount) + 1 End With End Sub Sub DecrimentFormsListboxSelection() With Sheets("Sheet1").Shapes("List Box 1").ControlFormat .ListIndex = IIf(.ListIndex = 1, .ListCount, .ListIndex - 1) End With End Sub Sub Up_DownToNorma() Application.OnKey "{down}" Application.OnKey "{up}" End Sub
-
WSmikerickson
AskWoody LoungerI can’t text ActiveX controls on my Mac at home.
Once the code for one listbox had been vetted, one could be moved to a class module.
Each sheet’s Activate event could cause the appropriate controls to look to that class for their event code.In a code module (named clsAllBoxes)
Public WithEvents aBox As msforms.ListBox Private Sub aBox_Click() MsgBox "ListBox clicked" End Sub
In a sheet’s code module
Private Sub Worksheet_Activate() Dim xBox As clsAllBoxes Set xBox = New clsAllBoxes Set xBox.aBox = ListBox1 On Error Resume Next myBoxes.Add Item:=xBox, key:=Me.Name & xBox.Name On Error GoTo 0 Set xBox = New clsAllBoxes Set xBox.aBox = ListBox2 On Error Resume Next myBoxes.Add Item:=xBox, key:=Me.Name & xBox.Name On Error GoTo 0 End Sub
And the Public variable myBoxes is declared in a Normal Module
Public myBoxes as New Collection
-
WSmikerickson
AskWoody LoungerNovember 12, 2008 at 3:37 pm in reply to: fine name in column, delete entire record (Excel 2003 Win XP) #1132465There are four functions in that routine.
If none of them works for you, the idea is to concoct a string (formulaString) such that the formulaspareColumn.FormulaR1C1 = "=1/(1-(" & formulaString & ")"
will return an error value for those rows that you want deleted.
Merged cells get in the way of so many procedures that I prefer CenterAcrossSelection, when possible.
-
WSmikerickson
AskWoody LoungerNovember 11, 2008 at 3:10 am in reply to: fine name in column, delete entire record (Excel 2003 Win XP) #1132052The attached routine will delete duplicated rows without looping. There are options for
delete all duplicated rows (Sam, Dave, Mary, Sam, John, Dave >> Mary, John)
keep first duplicated row, delete the rest (Sam, Dave, Mary, Sam, John, Dave >> Sam, Dave, Mary, John)
Delete all rows that match the name the user inputs
Keet the first row of the user input name, delete the other occurances.For mass coloring, you could use Condiditonal Formatting.
-
WSmikerickson
AskWoody LoungerGlad to have helped.
This might help to wade through the remaining 1/3:
Advanced Filter also will take pattern matching. If you have a two row, one column Criteria Range
Name
*John*It will show all rows where “John” is a sub-string of the entry in the column that has “Name” as its header.
-
WSmikerickson
AskWoody LoungerThere are a couple of things you could do.
If the list in Tater!C6:Q1222 were sorted (on C), you could use VLOOKUP with 1 as the last argument to find an approximate match.Another approach uses =TRIM(LEFT(TRIM($E7),FIND(CHAR(5),SUBSTITUTE(TRIM($E7),” “,CHAR(5),2)&CHAR(5)))) to turn E7’s “Smith, John A.” or “Smith, John Adam” into “Smith, John” (It takes everything before the second space (after trimming the double spaces down to single spaces)
Then =VLOOKUP(TRIM(LEFT(TRIM($E7),FIND(CHAR(5),SUBSTITUTE(TRIM($E7),” “,CHAR(5),2)&CHAR(5)))) & “*”, Tater!$C$6:$Q$1222, 8, False) will return a match for the first entry that begins with “Smith, John”. Note the use of the wildecard “*” in the VLOOKUP.
It will match with “Smith, John” or “Smith, John A” or “Smith, John Bob” or “Smith, Johnson and Kline”, which ever is first in Tater!C:C.
-
WSmikerickson
AskWoody LoungerNovember 7, 2008 at 3:53 pm in reply to: Find part of name within full name field (Excel 2003 / SP2) #1131781Put this formula in Sheet1 G2 and drag down
=INDEX(Sheet2!D:D,MATCH(“*”&SUBSTITUTE($B2,” “,”*”)&”*”,Sheet2!G:G,0),1)It searches Sheet2’s Name column for the first entry that has both the first and last name from Sheet1’s User Full Name Column.
Another approach would be to create a Custom List from Sheet1 column B and use that list to sort Sheet2 (sort on G).
This should bring the matching rows of Sheet2 to the top of the sheet.I notice that only one of the names on Sheet1 have a match on Sheet2.
-
WSmikerickson
AskWoody Lounger
With ActiveSheet.Cells.SpecialCells(xlCellTypeVisible)
If .Areas.Count = 1 Then
MsgBox "no columns are hidden"
Else
MsgBox .Areas(2).Column & " is the first visible column after the hidden columns."
End If
End With -
WSmikerickson
AskWoody LoungerThere are a couple of other ways to do this.
These use the Application.InputBox method rather than the InputBox function. One difference between the two is that Application.InputBox can accept ranges input via mouse.
Sub HideColumnsChosenWithMouse()
Dim uiFirstColumn As Range
Dim uiLastColumn As RangeOn Error Resume Next
Set uiFirstColumn = Application.InputBox("Select the first column with the mouse", Type:=8)
On Error GoTo 0
If uiFirstColumn Is Nothing Then Exit Sub: Rem cancel pressedOn Error Resume Next
Set uiLastColumn = Application.InputBox("Select the last column with the mouse", Type:=8)
On Error GoTo 0
If uiLastColumn Is Nothing Then Exit Sub: Rem cancel pressedRange(uiFirstColumn, uiLastColumn).EntireColumn.Hidden = True
End SubThe user typing in a column address requires validation, in case they type an invalid column name, like “Apple Pie”
Sub HideColumnsFromTypedAddresses()
Dim uiFirstCollAddress As Variant
Dim uiLastCollAddress As Variant
Dim EntryIsValidColumnAddress As BooleanDo
uiFirstCollAddress = Application.InputBox("Enter the number/letter of the first hidden column.", Type:=7)
If uiFirstCollAddress = False Then MsgBox "x": Exit Sub: Rem cancel pressed
On Error Resume Next
EntryIsValidColumnAddress = (TypeName(Columns(uiFirstCollAddress)) = "Range")
On Error GoTo 0
Loop Until EntryIsValidColumnAddressEntryIsValidColumnAddress = False
Do
uiLastCollAddress = Application.InputBox("Enter the number/letter of the last hidden column.", Type:=7)
If uiLastCollAddress = False Then MsgBox "x": Exit Sub: Rem cancel pressed
On Error Resume Next
EntryIsValidColumnAddress = (TypeName(Columns(uiLastCollAddress)) = "Range")
On Error GoTo 0
Loop Until EntryIsValidColumnAddressRange(Columns(uiFirstCollAddress), Columns(uiLastCollAddress)).Hidden = True
End SubOr you could have the user select the whole range of columns to be hidden rather than specify start and end.
Sub HideColumnsInOneSwellFoop()
Dim uiRangeSelectedOn Error Resume Next
Set uiRangeSelected = Application.InputBox("Select cells from all the columns you want hidden.", Type:=8)
On Error GoTo 0
If uiRangeSelected Is Nothing Then Exit Sub: Rem Cancel presseduiRangeSelected.EntireColumn.Hidden = True
End Sub -
WSmikerickson
AskWoody LoungerYou don’t need to be as elaborate as that routine.
The key that I found is that when using the .NavigateArrows method, the ArrowNumber for all off-sheet precedents (dependents) is 1, so you only have to loop through the second index. Note that .NavigateArrows Selects the precedent (dependent) cell.
The routine in the link is basicaly this (plus bells&whistles and references to closed workbooks. (NavigateArrows only leads to open workbooks))Do
i = i+1
sourceCell.NavigateArrows(True,1,i)
MsgBox ActiveCell.Address(,,,True) & " is a precedent of " & sourceCell.Address(,,,True)
Loop Until ActiveCell.Address(,,,True) = sourceCell.Address(,,,True)If I recall correctly, the order that they appear will be their order in the formula (left to right).
Edit: Oh yeah, sourceCell.TracePrecedents before using .NavigateArrows. Its a screen intensive process, so Application.ScreenUpdating=False is a big time saver.
-
WSmikerickson
AskWoody LoungerNo, there isn’t an easy way to trace the off-sheet precedents of a formula.
This Link has a Sub (RunMe) that will show all the precedents (on and off sheet) of the Active Cell -
WSmikerickson
AskWoody LoungerSeptember 14, 2008 at 12:23 am in reply to: Add a sheet in the Active Workbook (Excel 2003) #1125532If you run this code
Dim newWorkbook As Workbook, myFullFile As String
myFullFile = Application.GetOpenFilename
If myFullFile = "False" Then
Exit Sub: Rem Cancel pressed
Else
Set newWorkbook = Application.Workbooks.Add(myFullFile)
End IfIt will prompt you to select a file and will create a duplicate of that file.
-
WSmikerickson
AskWoody LoungerThere are a couple of ways one could go with this.
You could put this in the sheets code module. (If the lay-out has changed from the attachment, ranges will need to be adjusted.)Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim altMenuMessage As String, altPrice As Double, altMenuItem As String
altMenuItem = "Chicken Strips with Chips"
altPrice = 3.29
altMenuMessage = "There is no child's menu avaliable." & vbCr
altMenuMessage = altMenuMessage & "Would you like to order the " & altMenuItem & " ("
altMenuMessage = altMenuMessage & Format(altPrice, "currency") & ")?"
With Target
If .Cells.Count = 1 And (.Column = 10 Or .Column = 12) Then
If .EntireRow.Range("I1").Value = "Lindsey" _
And .EntireRow.Range("J1")=vbNullString _
And .EntireRow.Range("L1")=vbNullString Then
If MsgBox(altMenuMessage, vbYesNo) = vbYes Then
.Value = altMenuItem
.Offset(0, 1) = altPrice: Rem Indicated line
End If
End If
End If
End With
End SubHowever, overwriting the formula in the price column makes changing Lindsey’s mind a problem.
What you could do about that is:1) Put “Chicken Strips With Chips” in C8 and 3.29 in G8. Changing the font color to white in both cells will hide this. Since these cells are outside the range the Validation draws from, it won’t add Chicken Strips to the others’s menus.
2 ) Change the range in all the VLOOKUPS to =IF(J3>””,VLOOKUP(J3,$C$2:$G$17,5,FALSE),”0.00″). Since no Starter has the same name as a Main Course this would cause no problems.
3) Remove the Indicated Line from the VB routine.
I hope this helps.
-
WSmikerickson
AskWoody LoungerI’m glad it worked for you.
-
WSmikerickson
AskWoody LoungerSelecting and Copy/PasteSpecial is not needed, unless you want to go to the sheet horizontal.
With Selection
Sheets('horizontal").Range("A65536").End(xlup).Offset(1, 0).Resize(1,.Rows.Count).Value = Application.Transpose(.Value)
End With
![]() |
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 |

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
-
Awoke to a rebooted Mac (crashed?)
by
rebop2020
14 minutes ago -
Office 2021 Perpetual for Mac
by
rebop2020
21 minutes ago -
False error message from eMClient (Awaiting moderation)
by
WSSebastian42
52 minutes ago -
Difface : Reconstruction of 3D Human Facial Images from DNA Sequence
by
Alex5723
3 hours, 53 minutes ago -
Seven things we learned from WhatsApp vs. NSO Group spyware lawsuit
by
Alex5723
4 hours, 15 minutes ago -
Outdated Laptop
by
jdamkeene
9 hours, 18 minutes ago -
Updating Keepass2Android
by
CBFPD-Chief115
14 hours, 43 minutes ago -
Another big Microsoft layoff
by
Charlie
14 hours, 23 minutes ago -
PowerShell to detect NPU – Testers Needed
by
RetiredGeek
5 hours, 21 minutes ago -
May 2025 updates are out
by
Susan Bradley
14 hours, 48 minutes ago -
Windows 11 Insider Preview build 26200.5600 released to DEV
by
joep517
20 hours, 27 minutes ago -
Windows 11 Insider Preview build 26120.3964 (24H2) released to BETA
by
joep517
20 hours, 29 minutes ago -
Drivers suggested via Windows Update
by
Tex265
20 hours, 20 minutes ago -
Thunderbird release notes for 128 esr have disappeared
by
EricB
18 hours, 4 minutes ago -
CISA mutes own website, shifts routine cyber alerts to X, RSS, email
by
Nibbled To Death By Ducks
1 day, 3 hours ago -
Apple releases 18.5
by
Susan Bradley
21 hours, 45 minutes ago -
Fedora Linux 40 will go end of life for updates and support on 2025-05-13.
by
Alex5723
1 day, 4 hours ago -
How a new type of AI is helping police skirt facial recognition bans
by
Alex5723
1 day, 5 hours ago -
Windows 7 ISO /Windows 10 ISO
by
ECWS
12 hours, 39 minutes ago -
No HP software folders
by
fpefpe
1 day, 13 hours ago -
Which antivirus apps and VPNs are the most secure in 2025?
by
B. Livingston
10 hours, 24 minutes ago -
Stay connected anywhere
by
Peter Deegan
1 day, 18 hours ago -
Copilot, under the table
by
Will Fastie
1 day, 9 hours ago -
The Windows experience
by
Will Fastie
2 days ago -
A tale of two operating systems
by
Susan Bradley
4 hours, 55 minutes ago -
Microsoft : Resolving Blue Screen errors in Windows
by
Alex5723
2 days, 6 hours ago -
Where’s the cache today?
by
Up2you2
2 days, 21 hours ago -
Ascension says recent data breach affects over 430,000 patients
by
Nibbled To Death By Ducks
2 days, 14 hours ago -
Nintendo Switch 2 has a remote killing switch
by
Alex5723
1 day, 14 hours ago -
Blocking Search (on task bar) from going to web
by
HenryW
16 hours, 41 minutes 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.