View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Carrie_Loos via OfficeKB.com Carrie_Loos via OfficeKB.com is offline
external usenet poster
 
Posts: 116
Default End if without Block If

Thanks - This look like it will work. And to answer your question, the "No"
button is in fact backwards should be Yes.

Out of curiosity - why avoid the one liners? Too many issues? or just better
housekeeping? Maybe both?

Dave Peterson wrote:
I'd try:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

Dim ans As Long

If Target.Address = me.Range("p1").Address Then
ans = MsgBox("Are you finished inputing Daily Info?", vbYesNo)
If ans = vbNo Then
me.parent.SaveAs Filename:=me.Range("A1").Value & _
Format(me.parent.Worksheets("Daily") _
.Range("ax1").Value, "yyyy-mm-dd") & ".xls"
End if
End If
End Sub

Personally, I avoid those if/then one liners. I like the block if/then/else
structures.

And you sure you want to check to see if the user hit the No button?

me is the worksheet with the code.
me.parent is the workbook that owns the worksheet with the code. I like that
better than using Activeworkbook.

You know, I started off that way but then the macro just doesn't respond, I
can't even get the cursur to move with striking the enter key. So I thought

[quoted text clipped - 15 lines]
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200805/1



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200805/1