scope of public sub in a worksheet

hi
i have a public sub in a worksheet "a" :

public sub ABC()
''blabla bla
end sub

in the same workbook i have a modal userform that on clicking one of its buttons - calls that public sub in the worksheet.

now, calling like this
worksheets("a").ABC
fails with an error (dont remember which)

but if i write :
thisworkbook.worksheets("a").ABC
- well, that's fine.......

why ?
the sub is public and in the same workbook where the call comes from.

You have to specify the sheet

You have to specify the sheet the code is resident on... Sheet1.Blah etc

Nick's picture

agree it shld work as you

agree it shld work as you suggest, but what problem is this causing you ?

no problem

exept that it took me 6 hours of guessing why the sub raise an error until i tried to add ThisBookmark......

and exept i write vba for years and never have such case before

tnx