Cycle sheets&copy paste values

DanK

New Member
Joined
Jul 20, 2009
Messages
10
Trying to write code to perform a copy/paste values action on all sheets except one. I started with this but not sure if it is even close.
If the "Index" page is first in the series does it stop there?

For i =1 Worksheets.Count
if sheets(i).Name <> "Index"
Sheets(i).Activate
RNG= Sheets(Worksheets(i).Range("A1:AZ5004")).cells.select 'trying to just select the whole sheet.
RNG.Copy
Worksheets(i).Range("A1:AZ5004").PasteSpecial xlPasteValues
End if
Next i
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Think about using something like usedRange or CurrentRegion

with activesheet
.Range("A2").CurrentRegion.Copy
end with
 
Upvote 0
Figured it out ten minutes after i asked....

For i = 1 To Worksheets.Count
If Sheets(i).Name <> "Index" And Sheets(i).Name <> "Template" Then
Sheets(i).Activate
Range("A1:AZ5004").Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Range("A1").Select
Application.CutCopyMode = False

End If
Next i
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,734
Members
452,939
Latest member
WCrawford

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