View Single Post
 
Old 03-08-2021, 04:26 AM
SamDsouza SamDsouza is offline Windows 10 Office 2013
Advanced Beginner
 
Join Date: Aug 2019
Posts: 71
SamDsouza is on a distinguished road
Default

Sir,
Quote:
Assuming this relates to userform code:
Yes Mostly i use Userform Objects

Thank you so much you made me remove the following
Code:
NonEmptyCellListStr = NonEmptyCellListStr & .RowIndex & ", " & .ColumnIndex & "^" 
NonEmptyCellsList =  Split((Replace(NonEmptyCellListStr, Chr(147), "")), "^")
OMG And How could I forget Combobox1.Additem

Nevertheless Inorder to have correct neat representation for Cell Reference uploaded in Combobox
Quote:
i changed
ComboBox1.AddItem .Cells(i).RowIndex & ", " & .Cells(i).ColumnIndex & "^"
to
ComboBox1.AddItem .Cells(i).RowIndex & ", " & .Cells(i).ColumnIndex
As I moved on to check Now for Empty Cell Reference with following code. Some unusual results
Code:
Private Sub EmptyCellRef()
Dim oTbl As Table
Dim i As Integer, sText As String, sList As String
    Set oTbl = ActiveDocument.Tables(1)
    With oTbl.Range
        For i = 1 To .Cells.Count
             sText = Trim(.Cells(i).Range.Text)
             If Split(sText, vbCr)(0) = "" Then                
                   ComboBox1.AddItem .Cells(i).RowIndex & ", " & .Cells(i).ColumnIndex 
            End If
        Next i
    End With
End Sub
I dont understand why the result is different. Have Attached .docx File

I get the List of Empty Cell Reference as

2, 2
2, 3
3, 1
3, 2
3, 3
4, 1
4, 2
4, 3

All though some of the above cell reference has some data. like cells 2, 2 and 2, 3

To have correct list of Empty Cell Reference as mentioned below
3, 1
3, 2
3, 3
4, 1
4, 2
4, 3

Do I have to consider the Paragraphs Aspect of Each cell. if yes then How ? to get the above mentioned Empty Cell Reference

SamD
Attached Files
File Type: docx Table-Cells-NonEmpty-Empty-Reference.docx (11.5 KB, 5 views)
Reply With Quote