This code needs to be in a sheet and not a workbook. The reason for whichyou are getting this error is because you have the same code in workbookalso.