compile error: wrong number of auguments or invalid property assignment

Cheek

New Member
Joined
Dec 1, 2010
Messages
11
Hi, I cannot figure out why I'm getting this compiling error. It happens when it hits the first "sheets" selection line. Any halp would be appreciated. thanks.

Dim Week1 As String
Dim Week2 As String
Dim MyName As String


MyName = ThisWorkbook.Name

Week1 = Worksheets("SSE Paste").Range("B400") 'This references a cell with a sheet name that populates based on a criteria. Values are like "Jul 9" for actual existing sheet names
Week2 = Worksheets("SSE Paste").Range("B401") '" "

ActiveWorkbook.Save

If Format(Date, "ddd") = "Fri" Then 'on Fridays i need it to select two sheets to be copied and sent
Sheets(Week1, Week2).Select 'this is the line where its stopping and saying "compile error: wrong number of arguments or invalid property assignment"
On Error GoTo 0

Else
Sheets(Week1).Select 'if its not Friday, i need it just copy and send one sheet

End If

Activesheets.Copy
Application.DisplayAlerts = False
ActiveWorkbook.BreakLink Name:= _
"\\10.1.100.245\scheduling\HCVR\Global HCVR\-Templates\" & "MyName" & ".xls", _
Type:=xlExcelLinks
ChDir "\\10.1.100.245\scheduling\HCVR\Global HCVR"
ActiveWorkbook.saveas FileName:= _
"\\10.1.100.245\scheduling\HCVR\Global HCVR\PM_Operations_Variance.xls", _
FileFormat:=xlExcel8, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.Dialogs(xlDialogSendMail).Show _
"PM Operations Variance", "PM_Operations_Variance.xls"
Application.DisplayAlerts = True

End Sub
 

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

Forum statistics

Threads
1,224,517
Messages
6,179,234
Members
452,898
Latest member
Capolavoro009

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