Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There are two types of buttons you can use on a worksheet--one is from the
Control toolbox toolbar and the other is from the Forms tooblar. My previous post had two different suggestions--one for each type button. Sonnich wrote: Dave Peterson wrote: Is this a commandbutton from the control toolbox toolbar? It is a button on a sheet. And is your code behind that worksheet? Set MyFile = Workbooks.Open(file1) Set AnotherFile = Workbooks.Open(file1) MyFile.DoSomething; blabla blabla PrintSomethingToSheetWithButton end; msgbox me.name would give you the name of the sheet that holds the code. causes "invalud used of keyword "me" or application.goto me.range("a1") to return to A1 of that sheet. ====== If you're using a button from the Forms toolbar: Dim ActSheet as worksheet set actsheet = activesheet 'do lots of stuff 'and you can refer to that variable application.goto actsheet.range("a1") 'or whatever Sonnich wrote: Hi! Once someone helped me to do so: Set MyFile = Workbooks.Open(file1) - myfile becomes an object I can work with. (thanks!) but how do I get the place, where my button is - the sheet, on which the event is triggered? BR Sonnich -- Dave Peterson -- Dave Peterson |