![]() |
#1
|
|||
|
|||
![]()
Hello
I was trying to implement to search Para No(s). like Autofilter Combobox via Auto Filtering ComboBox - TIP, TRICKS & CODE - OzGrid Free Excel/VBA Help Forum But somehow it is not Smooth operating. I dont know why Because when i type the Para No as 1 inthe Combobox Change Event then the dropdown should show list of 1, 10,11, 12,13,14,......21,31 etc if i type 2 then result 2, 12, 22,32.....etc The above results not happening. Dont know why Code:
Option Explicit Public myArrayParaList As Variant Public IsArrow As Boolean Public Sub GetParaList() Dim sList As String, i As Long, sText As String, myArrayParaList As Variant For i = 1 To ActiveDocument.Paragraphs.Count sText = Trim(Trim(ActiveDocument.Paragraphs(i).Range.Text)) If Split(sText, vbCr)(0) <> "" Then sList = sList & i & "," myArrayParaList = Split(sList, ",") End If Next i cmbParaNos.List = myArrayParaList End Sub Private Sub cmbParaNos_Change() Dim i As Long Dim oBkMrk As Bookmark Dim wdActDoc As Document Set wdActDoc = ActiveDocument With cmbParaNos If Not IsArrow Then .List = myArrayParaList If .ListIndex = -1 And Val(Len(.Text)) Then For i = .ListCount - 1 To 0 Step -1 'If InStr(1, .List(i), .Text, 1) = 0 Then .RemoveItem i If InStr(1, .List(i), Val(.Text), 1) = 0 Then .RemoveItem i Next i .DropDown End If End With End Sub Private Sub cmbParaNos_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) IsArrow = KeyCode = vbKeyUp Or KeyCode = vbKeyDown If KeyCode = vbKeyReturn Then cmbParaNos.List = myArrayParaList End Sub SMehta Thread 3: No: 46521 : Post No1 : TM 19 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trying to get number of para in Combobox | SMehta | Word VBA | 2 | 02-20-2021 07:15 AM |
How to autofilter by exact date? | LearnerExcel | Excel | 5 | 06-19-2018 03:30 PM |
Autofilter on two Date Columns | OTPM | Excel Programming | 3 | 04-29-2014 12:56 AM |
![]() |
Grasshopper | Excel | 3 | 02-14-2013 01:41 AM |
![]() |
coxjamd | Excel Programming | 2 | 01-17-2013 02:24 PM |