J
juls001
HI
I'm trying to copy some data from excel into a table in word, I loop
through the excel spreadsheet and put the data into the word table:
Do
oTable.Cell(i, 1).Range = Right(ActiveCell.Offset(0,
0).Value, 7)
oTable.Cell(i, 2).Range = ActiveCell.Offset(0, 1).Value
oTable.Cell(i, 3).Range = ActiveCell.Offset(0, 2).Value
oTable.Cell(i, 4).Range =
FormatNumber(ActiveCell.Offset(0, 3).Value, 2)
i = i + 1
ActiveCell.Offset(1, 0).Select
If IsEmpty(ActiveCell) = False Then
wrdDoc.Tables(4).Rows.Add
End If
It works fine (ie all 12 rows are copied) when I'm debugging, however
when I run it from the userform it gives me different results eg
sometimes 2 or 12 rows are there, sometimes 10 or 12 rows etc.
Can anyone help? Thanks in advance
I'm trying to copy some data from excel into a table in word, I loop
through the excel spreadsheet and put the data into the word table:
Do
oTable.Cell(i, 1).Range = Right(ActiveCell.Offset(0,
0).Value, 7)
oTable.Cell(i, 2).Range = ActiveCell.Offset(0, 1).Value
oTable.Cell(i, 3).Range = ActiveCell.Offset(0, 2).Value
oTable.Cell(i, 4).Range =
FormatNumber(ActiveCell.Offset(0, 3).Value, 2)
i = i + 1
ActiveCell.Offset(1, 0).Select
If IsEmpty(ActiveCell) = False Then
wrdDoc.Tables(4).Rows.Add
End If
It works fine (ie all 12 rows are copied) when I'm debugging, however
when I run it from the userform it gives me different results eg
sometimes 2 or 12 rows are there, sometimes 10 or 12 rows etc.
Can anyone help? Thanks in advance