Ch 6 hw file - Case Is ="dec" strMonth ="Jan" intYear = intYear 1 End Select E NewSheetName = strMonth& intYear N Exit

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Attribute VB_Name = "Functions" Option Explicit O Function NewSheetName(oldName As String) As String Dim strMonth As String Dim intYear As Integer D strMonth = Left(oldName, 3) On Error GoTo YearError intYear = CInt(Right(oldName, 4)) i Select Case LCase(strMonth) Case Is = "jan": strMonth = "Feb" Case Is = "feb": strMonth = "Mar" Case Is = "mar": strMonth = "Apr" Case Is = "apr": strMonth = "May" Case Is = "may": strMonth = "Jun" Case Is = "jun": strMonth = "Jul" Case Is = "jul": strMonth = "Aug" Case Is = "aug": strMonth = "Sep" Case Is = "sep": strMonth = "Oct" Case Is = "oct": strMonth = "Nov" Case Is = "nov": strMonth = "Dec"
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Case Is = "dec": strMonth = "Jan" intYear = intYear + 1 End Select E NewSheetName = strMonth & intYear N Exit Function YearError: oldName = CInt(InputBox("Please enter the 4-digit year for the previous worksheet.")) strMonth = InputBox("Please enter the 3-character month abbreviation for the previous worksheet.") Resume End Function E Sub TestFunction() Dim oldName As String Dim newName As String D Sheets.Add After:=Sheets(Sheets.Count) oldName = Sheets(Sheets.Count - 1).Name newName = NewSheetName(oldName) Sheets(Sheets.Count).Name = newName End Sub...
View Full Document

This note was uploaded on 08/15/2011 for the course ACIS 2504 at Virginia Tech.

Ask a homework question - tutors are online