Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 o formatting requirements I cannot use a formula. Can I do this usin VBA? Then I could have the macro run each time the workbook is close to keep the cell up to date. Thanks Rober -- Hammer_75 ----------------------------------------------------------------------- Hammer_757's Profile: http://www.excelforum.com/member.php...nfo&userid=741 View this thread: http://www.excelforum.com/showthread.php?threadid=40003 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks tom, that was too simple to be true -- 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What formatting requirements would stop a formula?
-- HTH RP (remove nothere from the email address if mailing direct) "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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Multiple fonts, check this post 'Multiple fonts in one cell (http://www.excelforum.com/showthread.php?t=399469 -- Hammer_75 ----------------------------------------------------------------------- Hammer_757's Profile: http://www.excelforum.com/member.php...nfo&userid=741 View this thread: http://www.excelforum.com/showthread.php?threadid=40003 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I spoke too soon :( Starting with Tom's sugestion, I came up with the following which work fine as long as I am on the first worksheet: Sub SheetNumberUpdate() 'Updates sheet number cell to match sheet (tab) name ActiveSheet.Range("E54").Font.Bold = False 'clears cell formating ActiveSheet.Range("E54").Value = "Sheet " & ActiveSheet.Name 'copies worksheetname to cell "Sheet #####" ActiveSheet.Range("E54").Characters(1, 5).Font.Bold = True 'sets the word "Sheet" to bold font End Sub However, when I use it on one of the other worksheets, say sheet 5 o 6, the cell is updated with the sheet name from the first worksheet. thought by using Activesheet. Range and Activesheet.name and making sur the desired sheet is active this would work. what am I missing -- Hammer_75 ----------------------------------------------------------------------- Hammer_757's Profile: http://www.excelforum.com/member.php...nfo&userid=741 View this thread: http://www.excelforum.com/showthread.php?threadid=40003 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
the code worked fine for me when used on any sheet that was active.
Produced the correct name. -- Regards, Tom Ogilvy "Hammer_757" wrote in message ... I spoke too soon :( Starting with Tom's sugestion, I came up with the following which works fine as long as I am on the first worksheet: Sub SheetNumberUpdate() 'Updates sheet number cell to match sheet (tab) name ActiveSheet.Range("E54").Font.Bold = False 'clears cell formating ActiveSheet.Range("E54").Value = "Sheet " & ActiveSheet.Name 'copies worksheetname to cell "Sheet #####" ActiveSheet.Range("E54").Characters(1, 5).Font.Bold = True 'sets the word "Sheet" to bold font End Sub However, when I use it on one of the other worksheets, say sheet 5 or 6, the cell is updated with the sheet name from the first worksheet. I thought by using Activesheet. Range and Activesheet.name and making sure the desired sheet is active this would work. what am I missing? -- 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Use a range value in place of sheet name | Excel Discussion (Misc queries) | |||
Automatically place text in one cell into cell in another sheet | New Users to Excel | |||
how do I place the sheet tab name in my spreadsheet by formula? | Excel Worksheet Functions | |||
Is there a formula that will place the sheet name in a cell? | Excel Worksheet Functions | |||
How do i place a graphic BEHIND an excel sheet? | Excel Programming |