In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to achieve vba validity verification drop-down multiple selection". In the daily operation, I believe that many people have doubts about how to achieve vba validity verification pull-down multiple selection. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubt of "how to achieve vba validity verification drop-down multiple selection". Next, please follow the editor to study!
Validity verification drop-down multiple selection
Create a drop-down menu
Set the multi-selection code:
Sub Worksheet_Change (ByVal Target As Range) Dim xRng As Range Dim xValue1 As String Dim xValue2 As String'in order to ensure that the user only selects a single cell If Target.Count > 1 Then Exit Sub 'when adding the On Error Resume Next statement, if the later program has a "runtime error", it will continue to run without interruption. On Error Resume Next 'locates a cell with validation conditions Set xRng = Cells.SpecialCells (xlCellTypeAllValidation) If xRng Is Nothing Then Exit Sub Application.EnableEvents = False' Intersect function returns a partial example of two or more cells overlapping: Intersect (Range ('a1Cells.SpecialCells d5'), Range (' c4Cells.SpecialCells g9')) If Not Application.Intersect (Target XRng) Is Nothing Then xValue2 = Target.Value 'event response If the worksheet changes, Undo, undo the table Application.Undo xValue1 = Target.Value Target.Value = xValue2 If xValue1 "" Then If xValue2 "" Then 'InStr function' the first parameter 1 means to start the search from the first location of the xValue1 'The string to search for the second parameter 'string found by the third parameter'& string concatenation If xValue1 = xValue2 Or InStr (1, xValue1, ", & xValue2) Or InStr (1, xValue1, xValue2 &",) Then Target.Value = xValue1 Else Target.Value = xValue1 & " "& xValue2 End If Application.EnableEvents = True End Sub
At this point, the study on "how to achieve vba validity verification drop-down multiple selection" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.