Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #15  
Old 09-27-2015, 12:09 AM
CodingGuruInTraining CodingGuruInTraining is offline Combining 2 tables into 1 and use Table2's column widths (hoping for workaround dealing merged cells Windows Vista Combining 2 tables into 1 and use Table2's column widths (hoping for workaround dealing merged cells Office 2010 32bit
Novice
Combining 2 tables into 1 and use Table2's column widths (hoping for workaround dealing merged cells
 
Join Date: Sep 2015
Posts: 13
CodingGuruInTraining is on a distinguished road
Default

I'm getting an error with this section saying "The requested member of the collection does not exist." When I hover over the i, it says i = 10, if that helps at all.
Code:
If .Cells(i + 4).ColumnIndex = 1 Then
        Set Rng = .Cells(i).Range
        Rng.End = .Cells(i + 4).Range.End
        Rng.Select: Selection.Cells.Merge
End If
I found out why some tables were going off the page; the tables had text wrapping on, which I know can also mess with repeating header rows. I tried adding the code below (after a few attempts) to the With Tbl section, and it centered the table, but when I go to the table properties the text wrapping is still on, which makes the header row not repeat (visually). Oddly enough, one table that had text wrapping on had all the text centered after the macro ran. When I turned text wrapping ON on a different table (just for testing) and ran the macro, neither had centered text.
Code:
    With Tbl
     .Range.Rows.WrapAroundText = False
Sorry I keep forgetting little additions, but I was wondering how you set the vertical and horizontal alignments per column/row. In your previous code I was able to add a part to a Case (as shown below), but I don't see where I can fit this in your current code for specific sections.
Code:
        For i = 5 To .Cells.Count
          Select Case (i Mod 5) + 1
            Case 1: sWdth = InchesToPoints(0.45)
                .Cells().VerticalAlignment = wdCellAlignVerticalTop
I played around with an If/Then situation, but I couldn't get it to work. The bit below runs, but it doesn't do anything and I'd prefer not to go cell by cell.
Code:
      With .Range
        .Cells(1).Select: Selection.Rows.HeadingFormat = True
        For i = 1 To 4
          .Cells(i).Width = InchesToPoints(sWdth(i))
        Next
        ''my addition
        If .Cells.Width = InchesToPoints(0.45) Then
            .Cells().VerticalAlignment = wdCellAlignVerticalTop
        End If
The attached image shows the alignments I'm hoping for. We're so close!
Attached Files
File Type: docx Table Template.docx (14.6 KB, 9 views)
Reply With Quote
 

Tags
column width, combine, tables



Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining 2 tables into 1 and use Table2's column widths (hoping for workaround dealing merged cells Table will not allow sorting because "cells are merged". I can't find the merged cells. wendyloooo Word Tables 1 05-26-2015 01:19 PM
Splitting one column into two with two different widths officeboy09 Excel 6 12-15-2013 09:48 PM
Pasting tables from Excel 2010 into Word 2010 - How to fix column widths? GracieB Word 7 10-02-2013 06:24 AM
Adjusting column widths norwood Word VBA 0 09-24-2013 06:53 AM
Combining 2 tables into 1 and use Table2's column widths (hoping for workaround dealing merged cells VBA code to fix column widths molesy Excel 3 09-16-2013 12:51 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:38 PM.


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