I referred to http://vbaexpress.com/forum/showpost.php?p=269199&postcount=1