+ Reply to Thread
Results 1 to 4 of 4

Thread: How do I determine Table Column Index Number?

  1. #1
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2003
    Posts
    116

    Question How do I determine Table Column Index Number?

    I'm trying to set an integer variable = to the Column.Index number for a particular cell in a given table. The row x column location of the selected cell is NOT however known to the macro. The column object seems to only be available under the Cell(RxC) parent, but the Cell(RxC) is unknown in my case.
    I have several tables in a DOC that have a merged cells in the bottom row(s). The number of these merged cell rows is not set. In the macro, I am moving around in the table doing various things, and at some point I need to know what column I'm in. And, due to the merged cells at the bottom, the Cell(RxC) position can get lost.
    So, I was hoping that the Column.Index property would give me my location, but I can't seem to determine the correct code structure. HELP!
    The following is close, but w/o the Cell(RxC) it won't compile.
    Column_Num = Selection.Table(1).Range.Cell().Column.Index
    Last edited by sauerj; 09-17-2010 at 09:26 AM. Reason: Andy Pope SOLVED this & my other Word Programming Question

  2. #2
    Valued Forum Contributor Norie's Avatar
    Join Date
    02-02-2005
    Posts
    512

    Re: How do I determine Table Column Index Number?

    What do you mean by a 'table'?

    There is no 'Table' object in the Excel Object model, not that I can find anyway.

    Though there does appear to be methods/properties/objects things like TableStyle which according to
    some resources are for pivot tables, and others tables (including pivot tables) ???

    The only other tables I can think of are QueryTables, DataTables.

    There's even a LocationInTable property for ranges which is apparently for pivot tables.

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    11,357

    Re: How do I determine Table Column Index Number?

    It's a Word related issue.

        With Selection
            If .Information(wdWithInTable) Then
                MsgBox "Active Row=" & .Information(wdStartOfRangeRowNumber) & vbLf & _
                       "Active Column=" & .Information(wdStartOfRangeColumnNumber), vbInformation
            End If
        End With
    Cheers
    Andy
    www.andypope.info

  4. #4
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2003
    Posts
    116

    Smile Re: How do I determine Table Column Index Number?

    Wow! Big HELP! ... SOLVED and merit given!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0