thanks Koolsid,

It is such a great code, it works fine in the VB program. but when i try to implement in the Visual Basic Excel, it seems like the LostFocus event cannot take effect, so do i need to change any command on that if i want to implement this code in VBA excel?

thanks in advance again!