View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Dave is offline
external usenet poster
 
Posts: 1,388
Default End if without Block If

Hi,
Try removing the End If at the end of the sub.
Your If Then statements are only one line of code each, so the End If is not
required.
Regards - Dave.

"Carrie_Loos via OfficeKB.com" wrote:

I think I am trying to do too much in one line but I am not sure how to write
it correctly. I want the user to be able to click on cell P1 and then a
message box ask if they have completed the input - If yes, then save the file
name and date, if no then end sub. I am getting the error message above and
can't figure it out. Can anyone help?

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim ans As Long

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

End If
End Sub

Thanks
Carrie

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