LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro works - very quick driller Excel Discussion (Misc queries) 6 October 10th 09 06:14 PM
Macro works Macro does not work Wanna Learn Excel Discussion (Misc queries) 4 March 24th 08 12:51 PM
Macro do works in excel... driller Excel Worksheet Functions 7 July 12th 07 02:56 PM
Email Macro only sometime works? PaulW Excel Discussion (Misc queries) 0 August 15th 06 10:22 AM
macro works in .xlt but not .xls BrianG[_3_] Excel Programming 6 September 18th 03 10:13 PM


All times are GMT +1. The time now is 04:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"