add additional info

Trevor3007

Well-known Member
Joined
Jan 26, 2017
Messages
675
Office Version
  1. 365
Platform
  1. Windows
morning i currently use the code below, but i also want to include 'invoice-" & the text in "G1"




Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    Set Target = Range("a10")
    If Target = "" Then Exit Sub
    On Error GoTo Badname
    
ActiveSheet.Name = "Invoice WC" & Format(Range("a10").Value, "dd-mm-yyyy")
    
    Exit Sub
Badname:
    MsgBox "Please revise the entry in a10." & Chr(13) _
    & "It appears to contain one or more " & Chr(13) _
    & "illegal characters." & Chr(13)
    Range("a10").Activate
    ActiveWorkbook.SaveAs Filename:="C:\Users\work3\OneDrive\UXL\Timesheets" & Application.PathSeparator & ActiveWorkbook.Sheets(1).Name
End Sub


so the tab would read :-

invoice-(cell G1) WC & Format(Range("a10").Value, "dd-mm-yyyy")

many thanks in advance.
KR
Trevor3007additional
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Try
Code:
ActiveSheet.Name = "Invoice " & range("G1") & " WC" & Format(Range("a10").Value, "dd-mm-yyyy")
 
Upvote 0
Try
Code:
ActiveSheet.Name = "Invoice " & range("G1") & " WC" & Format(Range("a10").Value, "dd-mm-yyyy")

hi Fluff,

fantastic & works a treat.

have a great weekend

KR
Trevor3007
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top