Flytt cell navn når men køre makro
Jeg har en makro som opretter faktura side 2 og 3.Celle F56 er omdøbt til total. Når jeg skal oprette side 2 skal celle navn Total flyttets til L56.
Det funger også fint, hvis jeg arbejde i den samme ark.
Problem er hver gang jeg skal lave en nyt faktura ved hjælp er makro tag jeg kopier jeg ark til et nyt ark i sammen projekt mappen. Men i nyt ark celle navn flytter ikke til L56 men den gøre den i master-faktura.
Her er makro tak
Sub Side2()
'
' Side2 Makro
' Makro indspillet 23-03-2009 af alijan
'
'
Range("B1:F61").Select
ActiveWindow.SmallScroll Down:=-30
Range("B1:F62").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=-60
Range("H1").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-6
Range("H19:K53").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("H20").Select
ActiveCell.FormulaR1C1 = "Overført fra side 1"
Range("L20").Select
ActiveCell.FormulaR1C1 = "=total"
Range("L20").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("F54").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(R[-35]C:R[-1]C)"
ActiveWindow.SmallScroll Down:=-18
Range("L17").Select
ActiveCell.FormulaR1C1 = "2 af 2"
With ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("F17").Select
ActiveCell.FormulaR1C1 = "1 af 2"
With ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("G17").Select
ActiveWindow.SmallScroll Down:=30
Range("F56").Select
ActiveWindow.SmallScroll Down:=-12
Range("B54").Select
ActiveCell.FormulaR1C1 = "Overført til side 2"
Range("B55:F60").Select
Selection.Interior.ColorIndex = xlNone
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.ClearContents
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("B1:F62,H1:L62").Select
Range("H1").Activate
ActiveSheet.PageSetup.PrintArea = "$B$1:$F$62,$H$1:$L$62"
ActiveWindow.SmallScroll Down:=-9
Range("H5").Select
End Sub