Paste Values

rlmarriott1

New Member
Joined
Jul 30, 2018
Messages
1
Hi All

Hoping for a little bit of help please - I'm not great with VBA so have developed a code based on adapting others. I'm trying to transpose information from one sheet into another. I've managed to do this so far, but I need to update the code to paste values. Can anyone help?

Thanks in advance

Code:
Sub Run_Cost_Report2()

Dim ws As Worksheet
Dim wsLast As Long
Dim wsStart As Range
Dim LR As Long, i As Long, j As Long
Dim mStart As Double
 
mStart = Timer
 
'Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
 
Set ws = Sheets("Cost Report")
ws.Range("C12:I65536").ClearContents
ws.Range("K12:M65536").ClearContents
Set wsStart = ws.Range("C" & ws.Rows.Count).End(xlUp)
 
With Sheets("Change")
     
    LR = .Range("C" & .Rows.Count).End(xlUp).Row
    j = 1
     
    For i = 12 To LR
         
        .Range("C" & i & ":E" & i).Copy wsStart.Offset(j, 0).Resize(5)
        .Range("G" & i & ":G" & i).Copy wsStart.Offset(j, 3).Resize(5)
        .Range("I" & i & ":J" & i).Copy wsStart.Offset(j, 4).Resize(5)
        .Range("L" & i & ":L" & i).Copy wsStart.Offset(j, 6).Resize(5)
         
        .Range("N" & i & ":O" & i).Copy wsStart.Offset(j, 8)
        .Range("P" & i & ":Q" & i).Copy wsStart.Offset(j + 1, 8)
        .Range("R" & i & ":S" & i).Copy wsStart.Offset(j + 2, 8)
        .Range("T" & i & ":U" & i).Copy wsStart.Offset(j + 3, 8)
        .Range("V" & i & ":W" & i).Copy wsStart.Offset(j + 4, 8)
        .Range("AA" & i & ":AA" & i).Copy wsStart.Offset(j, 10)
        .Range("AA" & i & ":AA" & i).Copy wsStart.Offset(j + 1, 10)
        .Range("AA" & i & ":AA" & i).Copy wsStart.Offset(j + 2, 10)
        .Range("AA" & i & ":AA" & i).Copy wsStart.Offset(j + 3, 10)
        .Range("AA" & i & ":AA" & i).Copy wsStart.Offset(j + 4, 10)
        j = j + 5
    Next i
End With
Call FormatCostReport
Application.Calculation = xlCalculationAutomatic
'Application.ScreenUpdating = True
 
Debug.Print Timer - mStart
End Sub
 
Last edited by a moderator:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
This won't solve your problem but you could remove

Code:
j=1
and
Code:
j=j+5

and replace all other references to j within that loop to

Code:
(i-1)*5+12
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top