View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default A macro code question from a novice

- worksheets are not (normally) suffixed with .xls

- worksheets names are usually enclosed in quotes unless you really are
using a variable

- why unprotect one sheet, do things on other totally unrelated sheets, then
finally protect another one altogether

- you paste a shape and then locate it


Sub KSmith_signature()
If MsgBox("Are you sure you want to sign your timecard?", vbYesNo +
vbQuestion) = vbNo Then
Exit Sub
Else
Sheets("Sheet3").Shapes("Picture 2").Copy
With Sheets("Master")
.Paste
.Shapes("Picture 2").Left = Range("A32").Left
.Shapes("Picture 2").Top = Range("A32").Top
End With
End If
End Sub
--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Richard" wrote in message
...
The following is my code for a macro I want to run on a protected
worksheet.
My intent is for the macro to first unprotect the worksheet, then insert a
copy of the person's scanned signature on to the worksheet after they
answer
the question "Are you sure you want to sign your timecard?", and then
reprotect the worksheet. When the code runs, I'm getting an error message
"Compile error: Expected End Sub". I'm sure it's due to a mistake (or
more
than one) I've made. If anyone has time, would you please help me locate
my
error(s)?

Thanks and have a wonderful holiday season!

Sub KSmith_signature()
'
' KSmith_signature Macro
' Macro recorded 12/24/2007 by Richard
'

'
Worksheets(SMITH.XLS).Unprotect Password:="simple"
Sub AskAndDo()
If MsgBox("Are you sure you want to sign your timecard?", vbYesNo +
vbQuestion) = vbNo Then Exit Sub
Else
Sheets("Sheet3").Select
ActiveSheet.Shapes("Picture 2").Select
Selection.Copy
Sheets("Master").Select
Range("A32:I34").Select
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft 54.75
Range("I26").Select
End If
End Sub
Worksheets(BEARDSLEE.XLS).Protect Password:="simple"
End Sub