+ Reply to Thread
Results 1 to 3 of 3

Delete Empty Rows and empty columns from the word table

  1. #1
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Delete Empty Rows and empty columns from the word table

    I am trying to populate the 2 tables from excel to word. I will be getting the excel file with tables in various sheets. One sheet consist of 2 tables that will be inserted to one word document. So if there are 2 sheets then I will have the tables inserted in the 2 word document. In the excel sheet I have attached, there are 2 sheets with tables in each of them. I have written the code to copy and paste the table to word doc from (general) range A1:G4 (Table 1) and A9:H18 (Table 2) that has empty rows and columns selected. But there are empty rows and columns inserted since the table range is not same sheetwise. I would like get the empty rows and columns deleted in the word table. Can some one help me on this? Please find the attached sample excel sheet and the word documents.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Delete Empty Rows and empty columns from the word table

    You didn't include your code.

    I would suggest instead of deleting rows\columns from the Word doc, it would be easier to copy only the cells with data instead of a fixed size range. There are several methods to define used cell areas in VBA depending on the nature of your data. Below are two examples to copy only the rows with data from sheet 1

    Please Login or Register  to view this content.
    Here's a very good guide with other examples. If you do a web search, you can find several more guides.
    Select Actual Used Range in Excel Sheet
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: Delete Empty Rows and empty columns from the word table

    Hi Apha,
    Oops I am sorry about that. Here is the code
    Please Login or Register  to view this content.
    in this code snippet, i am copy and pasting the table from excel sheet to word where there is a bookmarks tab1 and tab2 in word.
    Will I be able to select the used range for sheets even though there have different range (like start and end range)? I will absolutely look at the guide as well. Thanks for the reply.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Delete rows when two columns are empty
    By Musoguy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-29-2013, 09:00 AM
  2. how to delete empty rows or columns only
    By tallercheetah in forum Excel General
    Replies: 3
    Last Post: 02-02-2012, 10:44 AM
  3. Find empty columns, rows and delete
    By ebe in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-27-2010, 10:00 AM
  4. [SOLVED] Delete rows with empty cells in columns B&C
    By Richard in forum Excel General
    Replies: 3
    Last Post: 03-17-2006, 08:20 PM
  5. [SOLVED] Code to Delete Empty Rows in a Word Table
    By Araknia777 via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2005, 05:05 PM

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.6.0 RC 1