Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a date in cell JI (dd/mmm/yy) I would like to print the corresponding
months chart, which is on a separate sheet. The tabs are named *** Sept** and *****Oct*** etc, * = letters/numbers, person who set the charts up didn't follow the same naming method for each chart. Is it possible to search the tabs for the three letter month abbreviation and print that chart. Date = 28/Sep/04 print Sep Sheet Date = 03/Oct/04 print Oct sheet Thanks, Jackie |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sun, 03 Oct 2004 12:12:26 GMT, "Jackie" wrote:
I have a date in cell JI (dd/mmm/yy) I would like to print the corresponding months chart, which is on a separate sheet. The tabs are named *** Sept** and *****Oct*** etc, * = letters/numbers, person who set the charts up didn't follow the same naming method for each chart. Is it possible to search the tabs for the three letter month abbreviation and print that chart. Date = 28/Sep/04 print Sep Sheet Date = 03/Oct/04 print Oct sheet Thanks, Jackie Assuming the sheets to be printed are in the active workbook and that the date is in the active sheet maybe this can be something to test. Sub print_sheets_with_name_including_month_from_date_i n_cell_J1() months = "janfebmaraprmayjunjulaugsepoctnovdec" mon = Mid(months, 3 * Month(Range("J1").Value) - 2, 3) For i = 1 To Worksheets.Count If InStr(LCase(Worksheets(i).Name), mon) 0 Then Worksheets(i).PrintOut End If Next i End Sub Hope this helps Lars-Åke |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Lars-Åke Aspelin, Thanks
"Lars-Åke Aspelin" wrote in message ... On Sun, 03 Oct 2004 12:12:26 GMT, "Jackie" wrote: I have a date in cell JI (dd/mmm/yy) I would like to print the corresponding months chart, which is on a separate sheet. The tabs are named *** Sept** and *****Oct*** etc, * = letters/numbers, person who set the charts up didn't follow the same naming method for each chart. Is it possible to search the tabs for the three letter month abbreviation and print that chart. Date = 28/Sep/04 print Sep Sheet Date = 03/Oct/04 print Oct sheet Thanks, Jackie Assuming the sheets to be printed are in the active workbook and that the date is in the active sheet maybe this can be something to test. Sub print_sheets_with_name_including_month_from_date_i n_cell_J1() months = "janfebmaraprmayjunjulaugsepoctnovdec" mon = Mid(months, 3 * Month(Range("J1").Value) - 2, 3) For i = 1 To Worksheets.Count If InStr(LCase(Worksheets(i).Name), mon) 0 Then Worksheets(i).PrintOut End If Next i End Sub Hope this helps Lars-Åke |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Lars-Åke
Code worked great but I have found there are several charts with the month and they all print. Charts can there be something like RC*** "mon" **. Hall**** "mon"*** etc *=wildcards. can chart be found with specific letters *RC*** and "mon"** to be printed Thanks, Jackie "Jackie" wrote in message o.uk... Lars-Åke Aspelin, Thanks "Lars-Åke Aspelin" wrote in message ... On Sun, 03 Oct 2004 12:12:26 GMT, "Jackie" wrote: I have a date in cell JI (dd/mmm/yy) I would like to print the corresponding months chart, which is on a separate sheet. The tabs are named *** Sept** and *****Oct*** etc, * = letters/numbers, person who set the charts up didn't follow the same naming method for each chart. Is it possible to search the tabs for the three letter month abbreviation and print that chart. Date = 28/Sep/04 print Sep Sheet Date = 03/Oct/04 print Oct sheet Thanks, Jackie Assuming the sheets to be printed are in the active workbook and that the date is in the active sheet maybe this can be something to test. Sub print_sheets_with_name_including_month_from_date_i n_cell_J1() months = "janfebmaraprmayjunjulaugsepoctnovdec" mon = Mid(months, 3 * Month(Range("J1").Value) - 2, 3) For i = 1 To Worksheets.Count If InStr(LCase(Worksheets(i).Name), mon) 0 Then Worksheets(i).PrintOut End If Next i End Sub Hope this helps Lars-Åke |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe...
Option Explicit Sub print_sheets_with_name_including_month_from_date_i n_cell_J1_v2() Dim myStr As String Dim wks As Worksheet 'get the month string from J1 myStr = Format(Worksheets("sheet1").Range("j1").Value, "mmm") myStr = "*rc*" & myStr & "*" For Each wks In ActiveWorkbook.Worksheets If LCase(wks.Name) Like LCase(myStr) Then wks.PrintOut preview:=True Exit For 'only one to print??? End If Next wks End Sub If you have more than one worksheet that can match your naming convention, remove the "exit for" line. And remove the preview:=true after you've tested it. (No sense killing trees!) Jackie wrote: Lars-Åke Code worked great but I have found there are several charts with the month and they all print. Charts can there be something like RC*** "mon" **. Hall**** "mon"*** etc *=wildcards. can chart be found with specific letters *RC*** and "mon"** to be printed Thanks, Jackie "Jackie" wrote in message o.uk... Lars-Åke Aspelin, Thanks "Lars-Åke Aspelin" wrote in message ... On Sun, 03 Oct 2004 12:12:26 GMT, "Jackie" wrote: I have a date in cell JI (dd/mmm/yy) I would like to print the corresponding months chart, which is on a separate sheet. The tabs are named *** Sept** and *****Oct*** etc, * = letters/numbers, person who set the charts up didn't follow the same naming method for each chart. Is it possible to search the tabs for the three letter month abbreviation and print that chart. Date = 28/Sep/04 print Sep Sheet Date = 03/Oct/04 print Oct sheet Thanks, Jackie Assuming the sheets to be printed are in the active workbook and that the date is in the active sheet maybe this can be something to test. Sub print_sheets_with_name_including_month_from_date_i n_cell_J1() months = "janfebmaraprmayjunjulaugsepoctnovdec" mon = Mid(months, 3 * Month(Range("J1").Value) - 2, 3) For i = 1 To Worksheets.Count If InStr(LCase(Worksheets(i).Name), mon) 0 Then Worksheets(i).PrintOut End If Next i End Sub Hope this helps Lars-Åke -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
chart printing | Charts and Charting in Excel | |||
Chart printing | Charts and Charting in Excel | |||
Printing Chart | Charts and Charting in Excel | |||
Printing a chart | Excel Discussion (Misc queries) | |||
Not all of chart printing | Charts and Charting in Excel |