M
margolis22
I have the following code that mostly works but I need some
additional assistance to complete it.
1st set of code finds the last worksheet : it works well
2nd set of code should copy the current worksheet (last one found fro
previous code) to new worksheet that is placed at the end and names th
worksheet for me. : It creates a new worksheet at the end but does no
copy the last worksheet
3rd set of code should copy Columns K to I. : I need help to have
this use the current worksheet. Currently it uses a static worksheet.
Thanks, JGM
Sub GotoLastSheet()
Dim i&
For i = Sheets.Count To 1 Step -1 ' Counting
backwards
If Sheets(i).Visible And TypeName(Sheets(i)) <> "Module" Then
Sheets(i).Select
Exit Sub
End If
Next i
End Sub
Sub NextTab()
' Load array with month abbreviations
Dim Months(12)
For X = 0 To 11
Months(X) = MonthName(X + 1, True)
Next X
Months(12) = "Jan"
' Determine current and new month / year values
CurMo = Left(ActiveSheet.Name, 3)
CurYr = Right(ActiveSheet.Name, 2)
NextMo = Months(Application.WorksheetFunction.Match(CurMo, Months, 0))
NextYr = CurYr
' Add 1 to the year if current month is December
If CurMo = "Dec" Then NextYr = NextYr + 1
TabName = NextMo & Right("00" & NextYr, 2)
' Add and name new worksheet
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = TabName
End Sub
Sub KtoI()
'
' KtoI Macro
' Macro recorded 01/29/2004 by Lanier Worldwide
'
' Keyboard Shortcut: Ctrl+k
'
Sheets("Feb04").Copy After:=Sheets(14)
ActiveWindow.SmallScroll Down:=240
ActiveWindow.LargeScroll Down:=-8
Columns("K:K").Select
Selection.Copy
Columns("I:I").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Range("A5").Select
End Su
additional assistance to complete it.
1st set of code finds the last worksheet : it works well
2nd set of code should copy the current worksheet (last one found fro
previous code) to new worksheet that is placed at the end and names th
worksheet for me. : It creates a new worksheet at the end but does no
copy the last worksheet
3rd set of code should copy Columns K to I. : I need help to have
this use the current worksheet. Currently it uses a static worksheet.
Thanks, JGM
Sub GotoLastSheet()
Dim i&
For i = Sheets.Count To 1 Step -1 ' Counting
backwards
If Sheets(i).Visible And TypeName(Sheets(i)) <> "Module" Then
Sheets(i).Select
Exit Sub
End If
Next i
End Sub
Sub NextTab()
' Load array with month abbreviations
Dim Months(12)
For X = 0 To 11
Months(X) = MonthName(X + 1, True)
Next X
Months(12) = "Jan"
' Determine current and new month / year values
CurMo = Left(ActiveSheet.Name, 3)
CurYr = Right(ActiveSheet.Name, 2)
NextMo = Months(Application.WorksheetFunction.Match(CurMo, Months, 0))
NextYr = CurYr
' Add 1 to the year if current month is December
If CurMo = "Dec" Then NextYr = NextYr + 1
TabName = NextMo & Right("00" & NextYr, 2)
' Add and name new worksheet
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = TabName
End Sub
Sub KtoI()
'
' KtoI Macro
' Macro recorded 01/29/2004 by Lanier Worldwide
'
' Keyboard Shortcut: Ctrl+k
'
Sheets("Feb04").Copy After:=Sheets(14)
ActiveWindow.SmallScroll Down:=240
ActiveWindow.LargeScroll Down:=-8
Columns("K:K").Select
Selection.Copy
Columns("I:I").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Range("A5").Select
End Su