Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro works separately but not together...
Hi!
I've compiled the following that works separately but now when I put the entire thing together... I get an error message... being good at copy and paste but not necessarily good at the "whatfors" I'm not sure where to look... Also, I wasn't sure where the error occurred so once again I'm not being brief and pasted the entire compilation... Sorry... (hopefully you'll see all your good work here and find my error with your wizardry... Sub Mail_Activesheet() Range("A1").Select Sheets("PAYROLL SHEET").Select Range("A4").Select ActiveSheet.Unprotect Password:="MONEY" Sheets("PAYROLL SHEET").Select Range("A4").Select Dim ans For i = 9 To 133 If Not IsEmpty(Cells(i, "A").Value) And IsEmpty(Cells(i, "u")) Then ans = "" Do While ans = "" ans = InputBox("Cell " & Cells(i, "V").Address(False, False) & " missing Total hours, please enter", "Data Completion") Loop End If Next i Range("a1").Select ActiveWorkbook.Save Dim rng As Range Dim rng1 As Range Set rng = Worksheets("sheet3").Range("A1").CurrentRegion rng.AutoFilter Field:=1, Criteria1:="<" Set rng1 = rng.Offset(1, 0). _ Resize(rng.Rows.Count - 1) rng1.Copy Sheets("HO Payroll").Range("A1") _ .PasteSpecial Paste:=xlValues, _ Operation:=xlNone, _ sKIPBLANKS:=False, _ Transpose:=False Application.CutCopyMode = False rng.AutoFilter Range("a4").Select Sheets("Sheet3").Select Range("A1").Select Dim strDate As String Sheets(Array("Payroll Sheet", "HO PAYROLL")).Copy Cells.Copy Cells.PasteSpecial xlPasteValues, xlPasteSpecialOperationNone, sKIPBLANKS:=False, Transpose:=False Cells(1).Select Application.CutCopyMode = False Sheets("PAYROLL SHEET").Select Range("ab1:dq775").Delete Range("a1").Select strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm") MsgBox "Remember to obtain the workbook password" & Chr(13) & _ " from the Payroll Department." ActiveSheet.SaveAs "Dummy'S " & Range("R4") & " " & "Payroll" & " " & strDate, FileFormat:=xlNormal, Password:="MONKEY", <-- error here WriteResPassword:="MONKEY", ReadOnlyRecommended:=False, CreateBackup:=False Range("A1").Select ActiveWorkbook.ChangeFileAccess xlReadOnly ActiveWorkbook.Close False Sheets("PAYROLL SHEET").Select ActiveSheet.Protect Password:="MONKEY", DrawingObjects:=True, CONTENTS:=True, Scenarios:=True Range("a1").Select End Sub Any ideas? Sorry about the length... thanks in advance for your time and assistance! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro works - very quick | Excel Discussion (Misc queries) | |||
Macro works Macro does not work | Excel Discussion (Misc queries) | |||
Macro do works in excel... | Excel Worksheet Functions | |||
Email Macro only sometime works? | Excel Discussion (Misc queries) | |||
macro works in .xlt but not .xls | Excel Programming |