how to auto change a file name?
Steve,
Here is one way
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sFile As String
Dim iPos As Long
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("C1")) Is Nothing Then
With Target
iPos = Application.Match(.Value, Me.Range("B3:B55"), 0)
sFile = "Week No." & .Value & " (" & _
Format(Application.Index(Me.Range("D3:D55"), iPos),
"dd.mm.yyyy") & _
")."
ThisWorkbook.SaveAs Filename:=sFile
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
It is worksheet event code, so right-click on the sheet tab, select View
Code from the menu, and past it in.
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Steven" wrote in message news:u8Knc.123$Kw6.2@newsfe1-win...
How could i make a workbook change its file name once data has been
entered
in a curtain cell?
example:
file name format would be, Week No.# (Date on sunday of that week).xls
all the data is stored in a list like this:
wk_num = B3:B55 = 1:53
week/start = D3:D55 = 29/03/2004:28/03/2005
week/end = E3:E55 dates = 04/04/2004:03/04/2005
if the current week is 7, user inputs 7 in cell A1 workbook now renames
to,
Week No.7 (16.05.2004).xls
hope that makes sense, many thanks for any help,
Steve
|