This Macro Needs To Run On Multiple Tabs

seankwest

New Member
Joined
Mar 12, 2012
Messages
8
Good morning,

I would like this Macro to run on 6 different tabs in a worksheet as one Macro. It is currently only running on the active sheet. The tabs that I need it to run on are labeled "Totals" "New" "Used" "Service" "Parts" "Other Income-Ded"
Any help is greatly appreciated!


Sub ExpenseAnalysis2012()
Dim rngSource As Range
Dim rngDestination As Range
Set rngSource = Range("D3:E90")
Set rngDestination = Cells(3, Columns.Count).End(xlToLeft).Offset(0, 2)
rngSource.Copy
rngDestination.PasteSpecial (xlPasteValues)
End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Try

Code:
Sub ExpenseAnalysis2012()
Dim rngSource As Range
Dim rngDestination As Range
Dim ws As Worksheet
For Each ws In Sheets(Array("Totals", "New", "Used", "Service", "Parts", "Other Income-Ded"))
    With ws
        Set rngSource = .Range("D3:E90")
        Set rngDestination = .Cells(3, Columns.Count).End(xlToLeft).Offset(0, 2)
        rngSource.Copy
        rngDestination.PasteSpecial (xlPasteValues)
    End With
Next ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,276
Messages
6,171,140
Members
452,381
Latest member
Nova88

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