Macro loop to paste as value

Negi1984

Board Regular
Joined
May 6, 2011
Messages
199
Hi All,

I am using below mentioned code for consolidating data.
can any one assist me to paste all the data as value while consolidating in "consolidate data" sheet.

Code:
Sub CopyRange()
        Dim bottomD As Integer
    Application.ScreenUpdating = False
    Dim WS As Worksheet
    For Each WS In Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27"))
        WS.Activate
        bottomD = Range("k" & Rows.Count).End(xlUp).Row
        Range("A2:k" & bottomD).Copy Sheets("Consolidate Data").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
    Next WS
    Application.ScreenUpdating = True
End Sub

[CODE]
Thanks in advance for your valuable suggestion.

Regards,
Rajender
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Code:
[COLOR=#333333]Sub CopyRange()[/COLOR]
[COLOR=#333333]Dim bottomD As Integer[/COLOR]
[COLOR=#333333]Application.ScreenUpdating = False[/COLOR]
[COLOR=#333333]Dim WS As Worksheet[/COLOR]
[COLOR=#333333]For Each WS In Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27"))[/COLOR]
[COLOR=#333333]WS.Activate[/COLOR]
[COLOR=#333333]bottomD = Range("k" & Rows.Count).End(xlUp).Row[/COLOR]
[COLOR=#333333]Range("A2:k" & bottomD).Copy
 Sheets("Consolidate Data").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).[/COLOR][COLOR=#303336][FONT=inherit]PasteSpecial xlPasteValues[/FONT][/COLOR][COLOR=#333333]
[/COLOR][COLOR=#333333]Next WS[/COLOR]
[COLOR=#333333]Application.ScreenUpdating = True[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
 
Upvote 0
Code:
[COLOR=#333333]Sub CopyRange()[/COLOR]
[COLOR=#333333]Dim bottomD As Integer[/COLOR]
[COLOR=#333333]Application.ScreenUpdating = False[/COLOR]
[COLOR=#333333]Dim WS As Worksheet[/COLOR]
[COLOR=#333333]For Each WS In Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27"))[/COLOR]
[COLOR=#333333]WS.Activate[/COLOR]
[COLOR=#333333]bottomD = Range("k" & Rows.Count).End(xlUp).Row[/COLOR]
[COLOR=#333333]Range("A2:k" & bottomD).Copy
 Sheets("Consolidate Data").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).[/COLOR][COLOR=#303336][FONT=inherit]PasteSpecial xlPasteValues[/FONT][/COLOR][COLOR=#333333]
[/COLOR][COLOR=#333333]Next WS[/COLOR]
[COLOR=#333333]Application.ScreenUpdating = True[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
Hi Truiz,

Thanks a lot for your prompt support.
Above code working fine for me :-).

Regards,
Rajender
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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