View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VBA to place sheet name in cell

You could use the BeforeSave event

See Chip Pearson's page on events
http://www.cpearson.com/excel/events.htm

worksheets(1).Range("B2').Value = "Sheet " & worksheets(1).Name

--
Regards,
Tom Ogilvy


"Hammer_757" wrote
in message ...

I am using a formula:
"Sheet "& MID(CELL("filename",B11),FIND("]",CELL("filename",B11))+2,
LEN(CELL("filename",B11))-FIND("]",CELL("filename",B11))) "

to place part of the worksheet name in a cell. However because of
formatting requirements I cannot use a formula. Can I do this using
VBA? Then I could have the macro run each time the workbook is closed
to keep the cell up to date.

Thanks
Robert


--
Hammer_757
------------------------------------------------------------------------
Hammer_757's Profile:

http://www.excelforum.com/member.php...fo&userid=7413
View this thread: http://www.excelforum.com/showthread...hreadid=400037