View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default How to go to next workbook?

his example is probably coded to be called from a formula in a cell
THEN the application caller will identify the cell it was called from.
and the application.caller.parent will id the sheet it was called from.

=sheetposition() typed in a cell will have the functon work,
but it cannot be called from a macro.





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Peter Chatterton wrote :

I want to copy to the next workbook,
but some code I found doesn't even start to work.

At http://www.cpearson.com/excel/sheetref.htm
it talks about worksheets but I get stuck at:
Application.Volatile True
v = Application.Caller.Parent.Index
which gives an 'object reqd' msg.

also
i = Application.Caller.Parent.Parent.Worksheets.Count
fails the same way.

I just did the latter with a copy/paste,
so it's not a typo problem.

I'm calling the macro from the spreadsheet with alt-F8.

Hope you can help,
Peter.