Hi Rocks,

I am a Mac User, and scripting in applescript is not much friendly for Microsoft. So I am here for VBA Script.

I had an Excel Data (in G Column) with the formula “=IF($A$2="","",CONCATENATE($L$1,$B$2))” upto 70 Cells. Based on the input given in A, B and C Columns. The Text will filled in G Column as below.

What I need is.

  1. Get Visible Values of Column G from active worksheet.
  2. Prompt the user to choose the word file.
  3. Create Table 1 with (Number of Rows: 1 and Number of Columns: 2) at the end of the word file, with G1 and G2 Values (with Borders and Cell formatting left align)
  4. Create Table 2 next to Table 1 with (Number of Rows: (may vary based upon the cells) and Number of Columns: 3) at end of the word file, with values start from G3 to upto end) (with Borders and Cell formatting left align)

Below Excel input for your reference.

Column A Column B Column C Column G
asdfg lkjh asdfg
a 5478 aaaa lkjh
b 00054878 bbb a
c cc ccc XXX#: 5478
YYY#: aaaa
b
XXX#: 00054878
YYY#: bbb
c
XXX#: cc
YYY#: ccc

Above Example shows 11 values.
2 values for 1st Table and balance 9 values for 2nd Table (i.e., divisible by 3)

Below is Output from word file

asdfg lkjh
a XXX#: 5478 YYY#: aaaa
b XXX#: 00054878 YYY#: bbb
c XXX#: cc YYY#: ccc

Any help should be appreciated.

Thanks in advance,
Rakesh