Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-21-2021, 10:11 PM
SMehta SMehta is offline Search Para No(s). thru Autofilter Combobox Windows 10 Search Para No(s). thru Autofilter Combobox Office 2013
Novice
Search Para No(s). thru Autofilter Combobox
 
Join Date: Jan 2021
Posts: 29
SMehta is on a distinguished road
Default Search Para No(s). thru Autofilter Combobox

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
Your guidance shall be appreciated.

SMehta
Thread 3: No: 46521 : Post No1 : TM 19
Reply With Quote
 



Similar Threads
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
Search Para No(s). thru Autofilter Combobox Sum on AutoFilter Grasshopper Excel 3 02-14-2013 01:41 AM
Search Para No(s). thru Autofilter Combobox AutoFilter Criteria3 coxjamd Excel Programming 2 01-17-2013 02:24 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft