Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get sheet name in formula or macro
Hi!
I need to write a macro/formula that uses the sheet name. I do not want to type it in but want it as some type of function like sheetname(). Then using that I like to manipulate the output of sheetname(). Can I do this? E.g., I have name each of my sheet as date of the month (like"1", "2", etc.). I like to get data from the previous day (worksheet). How can I do this without manually typing it each time? thank you, prashant -- Excel is excellent |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get sheet name in formula or macro
set sh = ActiveSheet
sName = sh.Name sName = cStr(clng(sName)-1) if sName = "0" then msgbox "No previous sheet" exit sub end if set sh1 = sheets(sName) msgbox sh1.Name another is set sh1 = activesheet.previous msgbox sh1.Name this assume the sheets are sequential in the tab order. -- Regards, Tom Ogilvy "psp" wrote in message ... Hi! I need to write a macro/formula that uses the sheet name. I do not want to type it in but want it as some type of function like sheetname(). Then using that I like to manipulate the output of sheetname(). Can I do this? E.g., I have name each of my sheet as date of the month (like"1", "2", etc.). I like to get data from the previous day (worksheet). How can I do this without manually typing it each time? thank you, prashant -- Excel is excellent |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get sheet name in formula or macro
hi,
you didn't say what ranges on the previous sheet you need to copy so.... sniplet activesheet.previous.select 'your copy code here seletion.copy activesheet.next.select 'paste it somewhere. this code sniplet will go to the previous sheet from active sheet, copy some data, return to the the first sheet you were on and paste the data somewhere. good luck -----Original Message----- Hi! I need to write a macro/formula that uses the sheet name. I do not want to type it in but want it as some type of function like sheetname(). Then using that I like to manipulate the output of sheetname(). Can I do this? E.g., I have name each of my sheet as date of the month (like"1", "2", etc.). I like to get data from the previous day (worksheet). How can I do this without manually typing it each time? thank you, prashant -- Excel is excellent . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to lookup a sheet, number, then display in origonal sheet | New Users to Excel | |||
Formula in macro or in sheet/cells? | Excel Worksheet Functions | |||
macro adding formula to new sheet | Excel Discussion (Misc queries) | |||
2 questions, copying data from sheet to sheet and assigning macro | Excel Worksheet Functions | |||
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet | Excel Programming |