I'm working with Excel 365 and try to copy cell contents in VBA.
In the following formula I get an error 13 because the target is of type 'Variant/Integer' and the source of 'Variant/String':
ActiveSheet.Cells(NewRow, ColumnCounter).Value = ActiveSheet.Cells(CurrentRow, ColumnCounter).Value
How can I fix this? Why is the target cell (of a newly inserted row) suddenly formatted as integer?
If I alternatively try:
tbl.ListRows(CurrentRow).Range.Copy
Set NewRow = tbl.ListRows.Add(TargetRow)
NewRow.Range.PasteSpecial xlPasteValuesAndNumberFormats
I get the error:
1004: paste special method of range class failed
.Range.
doing in that line? – BruceWayne