Quote Originally Posted by barebum
The code works well if workbook is opened manually. No errors occur. It is only when the workbook is opened from another workbook that the error occurs.
by default,
[VBA]
Range("totals!hosnum").Value = "NUMBER"
[/VBA]refers to
[VBA]
ActiveWorkbook.ActiveSheet.Range("totals!hosnum").Value = "NUMBER"
[/VBA]when the workbook is opened from another workbook you need to use explicit references to the workbook and worksheet to which the code is to apply...