View Single Post
 
Old 03-07-2021, 10:12 PM
SamDsouza SamDsouza is offline Windows 10 Office 2013
Advanced Beginner
 
Join Date: Aug 2019
Posts: 71
SamDsouza is on a distinguished road
Default How can i upload values of Non-Empty Cells Reference of a Table in ComboBox

Hello

Any ideas How can i upload values of ONLY Non-Empty Cells Reference of a Table in ComboBox. Bit Confused in getting the right syntax.

The below code gives all the Cell References in the table. Empty and Non-Empty

Code:
Public Sub NonEmptyCellRef()

Dim oTbl As Table
Dim NonEmptyCellListStr As String,  NonEmptyCellsList As Variant

Dim wdActDoc As Document
Set wdActDoc = ActiveDocument


Set oTbl = wdActDoc.Tables(1)
With oTbl.Range
  For i = 1 To .Cells.Count
    With .Cells(i)
          NonEmptyCellListStr = NonEmptyCellListStr & .RowIndex & ", " & .ColumnIndex & "^"  
          NonEmptyCellsList =  Split((Replace(NonEmptyCellListStr, Chr(147), "")), "^")
    End With
  Next
  ComboBox1.List = NonEmptyCellsList

End With

End Sub
SamD
Reply With Quote