Hello. I love the forums, and am new to posting. I keep getting error 1004 runtime error. It worked one day, but not now. HELP!!!!
Code
Option Explicit
Dim title As String
Dim ingred As String
Dim method As String
Dim rng As Range
Dim result As String
Dim xrow As Long
Private Sub Image1_Click()
If TextBox1.Value = "" Then
MsgBox "Whoops! Please enter a recipe name!"
Exit Sub
End If
If TextBox2.Value = "" Then
MsgBox "Whoops! Please enter ingredients!"
Exit Sub
End If
If TextBox3.Value = "" Then
MsgBox "Whoops! Please enter a cooking method!"
Exit Sub
End If
title = TextBox1.Value
ingred = TextBox2.Value
method = TextBox3.Value
result = MsgBox(title & ": " & ingred & " - " & method, vbYesNo, "Verify Recipe!")
If result = vbNo Then Exit Sub
Sheets("Recipe").Activate
xrow = Range("A1").End(xlDown).Row
xrow = xrow + 1
Sheets("Recipe").Cells(xrow, 1).Select
ActiveCell.Value = title
ActiveCell.Offset(0, 1).Value = ingred
ActiveCell.Offset(0, 2).Value = method
MsgBox "Recipe has been added!"
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox1.SetFocus
End Sub
Private Sub Image3_Click()
Unload Me
frmViewRecipe.Show
End Sub
Display More