Trevor3007
Well-known Member
- Joined
- Jan 26, 2017
- Messages
- 675
- Office Version
- 365
- Platform
- Windows
hi,
I have the following code:-
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Set Target = Range("d3")
If Target = "" Then Exit Sub
On Error GoTo Badname
ActiveSheet.Name = "Mytimes_WC_" & Format(Range("d3").Value, "dd-mm-yyyy")
Exit Sub
Badname:
MsgBox "Please revise the entry in d3." & Chr(13) _
& "It appears to contain one or more " & Chr(13) _
& "illegal characters." & Chr(13)
Range("d3").Activate
End Sub
and this code
Sub savetab()
'
' savetab Macro
'
ActiveWorkbook.SaveAs Filename:="C:\Users\Trevor\Desktop\Syn Timesheets From 010117" & Application.PathSeparator & ActiveWorkbook.Sheets(1).Name
'
End Sub
How do I combine them as one but only run when cell d3 has changed...
Also... when it saves, it checks to see if there is an existing same file name ( which is great) but if you say 'no' it comes back with the 'debug' error. Could you sort this too please.
MTIA
KR
Trevor3007
I have the following code:-
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Set Target = Range("d3")
If Target = "" Then Exit Sub
On Error GoTo Badname
ActiveSheet.Name = "Mytimes_WC_" & Format(Range("d3").Value, "dd-mm-yyyy")
Exit Sub
Badname:
MsgBox "Please revise the entry in d3." & Chr(13) _
& "It appears to contain one or more " & Chr(13) _
& "illegal characters." & Chr(13)
Range("d3").Activate
End Sub
and this code
Sub savetab()
'
' savetab Macro
'
ActiveWorkbook.SaveAs Filename:="C:\Users\Trevor\Desktop\Syn Timesheets From 010117" & Application.PathSeparator & ActiveWorkbook.Sheets(1).Name
'
End Sub
How do I combine them as one but only run when cell d3 has changed...
Also... when it saves, it checks to see if there is an existing same file name ( which is great) but if you say 'no' it comes back with the 'debug' error. Could you sort this too please.
MTIA
KR
Trevor3007
Last edited: