Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm a newbie so please forgive me if this topic has been posted. I
conducted a search, but didn't find a related topic. I have created a way of tracking my time and pay for multiple jobs (don't ask). In a nut shell, I use a seperate excel file (workbook) for each month. Then I have a seperate worksheet within each file that pretains to work done in a particular week. The names of the worksheets are based on the the Sunday date of that week, ex. the worksheet that pretains to January 8, 2006 thus is named 01082006. In addition, each file has a worksheet that sums everything that happened in the weeks of that month. Therefore, FEB06.xls ( the file for February '06) has six worksheets. They are named Total, 02012006, 02052006, 02122006, 02192006, 02262006. I would like to write a function that would allow me to call (Get/Insert/Whatever???) the name of one of the worksheets into a cell, then a function that would allow me to call a different worksheet name into a different cell. As a result, the function in A14 would return 02012006, A15 would return 02052006, etc.... Any help would be greatly appreciated. Thanks Omni |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this
Option Explicit Sub WsNames() Dim i As Long Dim sh As Worksheet i = 14 For Each sh In ActiveWorkbook.Sheets Range("A" & i) = sh.Name i = i + 1 Next End Sub -- Gary "Omni_belk" wrote in message oups.com... I'm a newbie so please forgive me if this topic has been posted. I conducted a search, but didn't find a related topic. I have created a way of tracking my time and pay for multiple jobs (don't ask). In a nut shell, I use a seperate excel file (workbook) for each month. Then I have a seperate worksheet within each file that pretains to work done in a particular week. The names of the worksheets are based on the the Sunday date of that week, ex. the worksheet that pretains to January 8, 2006 thus is named 01082006. In addition, each file has a worksheet that sums everything that happened in the weeks of that month. Therefore, FEB06.xls ( the file for February '06) has six worksheets. They are named Total, 02012006, 02052006, 02122006, 02192006, 02262006. I would like to write a function that would allow me to call (Get/Insert/Whatever???) the name of one of the worksheets into a cell, then a function that would allow me to call a different worksheet name into a different cell. As a result, the function in A14 would return 02012006, A15 would return 02052006, etc.... Any help would be greatly appreciated. Thanks Omni |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Gary. However, I am such a newbie, I have no idea were to paste
this. Thanks for the reply. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you can either paste it on the sheet code page or a module.
1. right click the sheet you're using and click view code or 2. press alt-f11 if the project explorer is not visible on the left, click view and then project explorer right click on one of the sheets and choose insert module paste the code there then alt-f8 and run the macro -- Gary "Omni_belk" wrote in message ups.com... Thanks Gary. However, I am such a newbie, I have no idea were to paste this. Thanks for the reply. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks
That is what I needed. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary-
Thanks, however I made an error in my example. Instead of going down (A14, A15, A16 etc... I need to go sideways (A3, B3, C3....) I tried to edit the formula, but that didn't work. I tried: Option Explicit Sub WsNames() Dim i As Long Dim sh As Worksheet i = G For Each sh In ActiveWorkbook.Sheets Range("1" & i) = sh.Name i = i + 1 Next End Sub Obviously this doesn't work, and I don't know enough to be able to correct this. Can you help me again? Thanks Omni |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this
Option Explicit Sub WsNames() Dim i As Long Dim sh As Worksheet i = 1 For Each sh In ActiveWorkbook.Sheets Cells(3, i) = sh.Name i = i + 1 Next End Sub -- Gary "Omni_belk" wrote in message ups.com... Gary- Thanks, however I made an error in my example. Instead of going down (A14, A15, A16 etc... I need to go sideways (A3, B3, C3....) I tried to edit the formula, but that didn't work. I tried: Option Explicit Sub WsNames() Dim i As Long Dim sh As Worksheet i = G For Each sh In ActiveWorkbook.Sheets Range("1" & i) = sh.Name i = i + 1 Next End Sub Obviously this doesn't work, and I don't know enough to be able to correct this. Can you help me again? Thanks Omni |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary,
Thanks Gary. The code you gave me works just as I asked. However, my question was flawed as I don't need to list the name of sheet1. So is it possible to have the module start with the name of sheet2? Sheet1 is a summary of the other sheets. As a result, I do not need to have the name in sheet1 anywhere in sheet1. The data in column B will come from sheet2, column C from sheet3, etc... Thanks again for your help. Omni |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
give this a try
Sub WsNames3() Dim i As Long Dim sh As Worksheet For i = 2 To Worksheets.Count Cells(3, i) = Worksheets(i).Name Next End Sub -- Gary "Omni_belk" wrote in message ups.com... Gary, Thanks Gary. The code you gave me works just as I asked. However, my question was flawed as I don't need to list the name of sheet1. So is it possible to have the module start with the name of sheet2? Sheet1 is a summary of the other sheets. As a result, I do not need to have the name in sheet1 anywhere in sheet1. The data in column B will come from sheet2, column C from sheet3, etc... Thanks again for your help. Omni |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For a non-programming method, see
http://www.mcgimpsey.com/excel/formu..._function.html In article .com, "Omni_belk" wrote: I'm a newbie so please forgive me if this topic has been posted. I conducted a search, but didn't find a related topic. I have created a way of tracking my time and pay for multiple jobs (don't ask). In a nut shell, I use a seperate excel file (workbook) for each month. Then I have a seperate worksheet within each file that pretains to work done in a particular week. The names of the worksheets are based on the the Sunday date of that week, ex. the worksheet that pretains to January 8, 2006 thus is named 01082006. In addition, each file has a worksheet that sums everything that happened in the weeks of that month. Therefore, FEB06.xls ( the file for February '06) has six worksheets. They are named Total, 02012006, 02052006, 02122006, 02192006, 02262006. I would like to write a function that would allow me to call (Get/Insert/Whatever???) the name of one of the worksheets into a cell, then a function that would allow me to call a different worksheet name into a different cell. As a result, the function in A14 would return 02012006, A15 would return 02052006, etc.... Any help would be greatly appreciated. Thanks Omni |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
automatically appending newly added data on worksheet to a master list worksheet | Links and Linking in Excel | |||
Upload multiple text files into 1 excel worksheet + put the filename as the first column in the worksheet | Excel Worksheet Functions | |||
I want in one worksheet to relatively link to/reference cells in another without changing the format of the current worksheet. | Excel Discussion (Misc queries) | |||
copy range on every worksheet (diff names) to a master worksheet (to be created) | Excel Programming | |||
Attaching a JET database to an Excel Worksheet OR storing large binary data in a worksheet | Excel Programming |