jtcurran96
New Member
- Joined
- May 6, 2008
- Messages
- 15
Is it possible to have a tab named by referencing a cell within a worksheet?
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "A1" Then
On Error Resume Next
Me.Name = Target.Value
On Error GoTo 0
End If
End Sub
Sub test()
Dim ws As Worksheet
Set ws = Worksheets.Add
Sheets("Sheet2").Range("A1:C10").Copy Destination:=ws.Range("A1")
Application.CutCopyMode = False
On Error Resume Next
ws.Name = ws.Range("A1").Value
On Error GoTo 0
End Sub
Sub inputit()
'
' inputit Macro
' Macro recorded 7/12/2008 by IT
' Modified on 9/4/2008 by ML
'
'
Sheets("FrontPage").Select
Sheets.Add
Range("B2").Select
ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:= _
False
'
'
' Change location text color and alignment
'
'
Range("B10").Select
Selection.Font.ColorIndex = 0
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
'
' Delete all the picures
'
Dim obj
For Each obj In ActiveSheet.Shapes: obj.Delete: Next
'
' Delete the top rows
'
Rows("1:8").Select
Selection.Delete Shift:=xlUp
'
'Change tab name and back to FrontPage'
Sheets("FrontPage").Select
Range("K2").formula = "=SUBSTITUTE(MID(B2,53,9),"":"",""-"")"
'
' this is where I want to have the tab named
'
Columns("B:B").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Columns("B:B").ColumnWidth = 66
Sheets("FrontPage").Select
Range("B1").Select
'
End Sub
Sheets("FrontPage").Select
Range("K2").Formula = "=SUBSTITUTE(MID(B2,53,9),"":"",""-"")"
'
' this is where I want to have the tab named
'
On Error Resume Next
ActiveSheet.Name = Range("K2").Value
On Error GoTo 0
Columns("B:B").SpecialCells(xlCellTypeBlanks).EntireRow.Delete