ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to detect if cells text go on other column ? (https://www.excelbanter.com/excel-programming/357448-how-detect-if-cells-text-go-other-column.html)

Alex St-Pierre

How to detect if cells text go on other column ?
 
Hi,
I copy an paste a table from excel to word. If cells are merged or text go
to an other column in excel, Word will merged theses cells. I would like to
find a way to know if the cells has been merged in Word ?

Example: if the table has 3 columns in excel and column 1 and 2 are merged.
Cells(1,3) in excel will refer the column #3 in excel but cells(1,2) in Word
will refer to the same column. So, I could add a vector:
myVector(1) = 1
myVector(2) = 3
In Word, I will say:
For i = 1 To tbl.Rows.Count 'word table
For j = 1 To tbl.Rows(i).cells.Count
tbl.Cell(i, j).Value = rngExcel.Cells(i, MyVector(j)).Value
Next j
Next i

How can I create MyVector(i) ? Does anyone know how to detect if a cell go
to an other column.

Thanks !
--
Alex St-Pierre


All times are GMT +1. The time now is 05:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com