I created a userform in a new workbook (not test.xls), put one commandbutton
on it and pasted in your code.
I then had workbook Test.xls open, but not active. I showed the userform
and clicked the commandbutton and it ran fine for me. (as expected).
Win 2000 and Excel 2002 but I have done similar in xl97, xl2000, Win 98SE
The only thing I can think of that would cause this error is if there is no
Data below A1. If you do End(xldown) and the column is empty you end up at
A65536, then trying to offset 1 cell below that (which doesn't exist) would
cause a 1004 error. If that is not the case then:
You can try application.Goto
Private Sub CommandButton1_Click()
Application.Goto workbooks("Test.xls"). _
Worksheets("Sheet1").Range("A1").End(xldown).Offset(1,0)
End Sub
Or you can just reference that cell and not try to select it
Dim rng as Range
set rng = workbooks("Test.xls"). _
Worksheets("Sheet1").Range("A1").End(xldown).Offset(1,0)
rng.Value = 21