VBA "Copy & Paste Special vs. VBA "Copy"


The below VBA copies data from one sheet (I6:I15) into another worksheet.    Values from I6:I7 are currently formulae.   Data for I8:I15 are actual values.

Instead of copying of the formulae for I6:I7, I need the actual output values to be copied over.   I am hoping to change the VBA from "copy" to "copy & paste special".

How does the VBA need to be changed to accommodate a paste special (vs. simple copy process)?


Private Sub RunUpdateOnFirst_Click()

	Range("I6:I15").Copy Destination:=Sheets("Tracking of Bills").Range(getNextHalf())
End Sub



Public Function getNextHalf(Optional ByVal first As Boolean = True)
    Dim i, j
    i = 2 'start at col B
    j = 1 'start at row 2
    If (Not first) Then
        j = 11 'row 11 for second half
    End If
    While (Sheet6.Cells(j, i).Value <> "")
        i = i + 1
    getNextHalf = Sheet6.Cells(j, i).Address
End Function

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Replace the following line...
Range("I6:I15").Copy Destination:=Sheets("Tracking of Bills").Range(getNextHalf())

Open in new window

Sheets("Tracking of Bills").Range(getNextHalf()).PasteSpecial xlPasteValues

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ExpExchHelpAnalystAuthor Commented:
Awesome... works perfectly!!!   Thank you for the prompt response.
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome. Glad it worked as desired.
Rob HensonFinance AnalystCommented:
You don't need to do the copy, you can just force the values across:

Sheets("Tracking of Bills").Range(GetNextHalf()) = Sheets("Sheet1").Range("I6:I15").Value

Open in new window

Replace Sheet1 with source sheet name.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.