Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Code updating Tabs

Status
Not open for further replies.

Mizzness

Programmer
May 2, 2003
174
US
All.

The following code copies a tab and updates the date within.
The problem is that it copies & values the range also.
My question is how can I just get it to paste the range as oppposed to paste/value (as it contains formulas) and have the code go back to the previous tab and paste/value that range.

Sub BetterThanEver()
'
' Format Macro
'
'

'
Sheets("P&L Var Summary 03_08").Copy Before:=Sheets(4)
With Sheets(4)
.Name = "P&L Var Summary " & Format(Date - 2, "mm_dd")
With .Range("B3:F15")
.Copy
.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End With
End With
Application.CutCopyMode = False
End Sub


Thanx for any and all help.
 
Hi,
Code:
Sub BetterThanEver()
    Dim ws1 As Worksheet
'
    Set ws1 = Sheets("P&L Var Summary 03_08")
    ws1.Copy Before:=Sheets(4)
    With Sheets(4)
        .Name = "P&L Var Summary " & Format(Date - 2, "mm_dd")
        .Range("B3:F15").Copy
        ws1.[B3].PasteSpecial _
            Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
            False, Transpose:=False
    End With
    Application.CutCopyMode = False
    
    Set ws1 = Nothing
End Sub


Skip,

[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top