Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Table cell manipulation (All)

    Hi

    How can create a macro that process two types of table in a document? This should be simple but my brain is just not working correctly at the moment. I know it should be for loop within for loop, i.e. first for loop to process each row in the 1st table and second for loop to process all other tables and compare.

    Table 1= (n rows, 5 columns). Need to extract process each row, extract data from columns (2 & 4)
    For all other tables (2 rows, 2 columns). Compare extracted data of column 4 from the first table with row 2, col 2 of the table until a match is found. If match found, insert extracted dat from column 2 into column 2 of the matched table.
    Thanks.
    Robie

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Table cell manipulation (All)

    You could do something like this:

    Dim i As Integer
    For i = 1 To ActiveDocument.Tables.Count
    If i = 1 Then
    ' Process ActiveDocument.Tables(i) here, this is the first table
    ...
    Else
    ' Process ActiveDocument.Tables(i) here, these are the other tables
    ...
    End If
    Next i

    or

    Dim i As Integer
    ' Process ActiveDocument.Tables(1) here
    ...
    For i = 2 To ActiveDocument.Tables.Count
    ' Process ActiveDocument.Tables(i) here, these are the other tables
    ...
    Next i

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Table cell manipulation (All)

    I knew it was simple Hans. That's just perfect. Thanks.
    Thanks.
    Robie

Posting Permissions

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