Zzzzzz
Board Regular
- Joined
- Oct 5, 2004
- Messages
- 206
I have two modules both using the same if statement which doesn't seem to be working...what am I doing wrong with this statement
If Right(ThisWorkbook.Name, 3) <> "XLS" Then
If Right(ThisWorkbook.Name, 3) <> "XLS" Then
Code:
Private Sub Workbook_Open()
If Right(ThisWorkbook.Name, 3) <> "XLS" Then
Sheets("Expenses").Activate
With Range("B6")
If .Value = "" Then
.NumberFormat = "@"
.Value = UCase(Format(Date, "dd-MMM-yy"))
Range("B4") = Environ("Username")
Range("I4").Select
End If
End With
End If
End Sub
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Right(ThisWorkbook.Name, 3) <> "XLS" Then
ThePath = "C:\Documents and Settings\pitfield\My Documents\Reports\Expense\"
TheDate = Format(Sheets("Expenses").Range("I4"), "yyyy-mmmm-dd")
Fname = "Expense Report " & TheDate
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:=ThePath & Fname & ".xls"
End If
End Sub