We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
How to make Sheet1 the same as a Cell in Excel
Robj241
Posts: 29 Forumite
in Techie Stuff
Hi,
I have a spreadsheet on Excel and I am wanting it to copy the cell information ie a date - 01.01.18 to replace the Sheet tab at the bottom.
Example
Cell E4 '01.01.18' needs to make sheet1 read '01.01.18'
Many thanks for any help.
I have a spreadsheet on Excel and I am wanting it to copy the cell information ie a date - 01.01.18 to replace the Sheet tab at the bottom.
Example
Cell E4 '01.01.18' needs to make sheet1 read '01.01.18'
Many thanks for any help.
0
Comments
-
You can do it via VBA.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set Target = Range("E4")
If Target = "" Then Exit Sub
Application.ActiveSheet.Name = VBA.Left(Target, 31)
Exit Sub
End Sub0 -
It's been a long time since I've done any VBA, but ... why the 2nd Exit Sub? Doesn't End Sub do the same thing?0
-
Thanks for the info.
So do I highlight the cell E3
Click on Macro - Visual Basic Editor
Click the drop down menu and select Worksheet
Type in the info provided
Then save?
Many thanks0 -
...or just right-click on the tab you want, and select "rename" ?......Gettin' There, Wherever There is......
I have a dodgy "i" key, so ignore spelling errors due to "i" issues, ...I blame Apple
0 -
Thing is you need some sort of event to trigger the renaming and If you are happy to right click then just
Right Click Cell/Copy
Right Click Tab/Rename/CTRL+V
The problem with the macro is that it renames the Tab EVERY TIME you select a cell (event trigger) for ever and ever amenIf I ruled the world.......0 -
Just right-click the sheet name, select View Code and copy the code I provided into the VBA editor that pops up.. Click Save and exit the VBA editor and away you go. The excel doc, however, must be saved as a Macro enabled worksheet (*.xlsm).Thanks for the info.
So do I highlight the cell E3
Click on Macro - Visual Basic Editor
Click the drop down menu and select Worksheet
Type in the info provided
Then save?
Many thanks0 -
Unfortunately this comes up as an error.
The Cell E3 contains a date - 01/01/18 but it won't allow /
Is there a way round this?
Many thanks for your assistance.0 -
If you don't want the code to run every time you change cells (which will be annoying) then try this:-
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$E$4" Then
Application.ActiveSheet.Name = VBA.Left(Target, 31)
End If
End Sub
It will fire every time you change a cell but won't do anything unless you're in cell E4.:wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:
Any posts are my opinion and only that. Please read at your own risk.0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 353.8K Banking & Borrowing
- 254.3K Reduce Debt & Boost Income
- 455.2K Spending & Discounts
- 246.9K Work, Benefits & Business
- 603.4K Mortgages, Homes & Bills
- 178.3K Life & Family
- 261K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards
