VBA call and run procedure for multipel sheets

Xceller

Active Member
Joined
Aug 24, 2009
Messages
265
I have a set code that would perform copy and paste value. It's name COPYPASTE.

I like to call and run COPYPASTE for multiple sheets. Is there a way to bypass selecting every sheet and run COPYPASTE?

My code:

Sub CallCV()
Dim vAnswer As Variant
vAnswer = MsgBox("Proceed?", vbYesNo + vbDefaultButton2)
If vAnswer = 6 Then


Sheets("PL1").Select
COPYPASTE

Sheets("PL2").Select
COPYPASTE

Sheets("PL3").Select
COPYPASTE

Sheets("PL4").Select
COPYPASTE

Sheets("PL5").Select
COPYPASTE

Else
MsgBox "You picked No!"
End If
End Sub()
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I think it would be useful to see what COPYPASTE is actually doing... can you post its code for us?
 
Upvote 0
I think it would be useful to see what COPYPASTE is actually doing... can you post its code for us?

I want to be able to put sheets("PL1"),("PL2")....in an array and run COPYPATE all at once.

COPYPASTE code:

Sub COPYPASTE()

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim Rcnt As Long, Ccnt As Long, r As Long, c As Long
Dim CurrCell As Range
On Error Resume Next
Rcnt = Cells.SpecialCells(xlLastCell).Row
Ccnt = Cells.SpecialCells(xlLastCell).Column
'-- check up to row 2 from the bottom
For r = Rcnt To 2 Step -1
'-- check all cells on row beginning at column 1
For c = 1 To Ccnt
If Cells(r, c).Font.Bold = False And Not IsEmpty(Cells(r, c)) Then
'-- Must be bold and have content
Cells(r, c).EntireRow.Value = Cells(r, c).EntireRow.Value
GoTo next_r
End If
Next c
next_r:
Next r
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,845
Members
452,948
Latest member
UsmanAli786

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