H
Howard
The code is in the "Groceries Needed" sheet module.
First InputBox... myMeal = a header in sheet named "Groceries Needed".
Second InputBox... ColmyMeal = the column of myMeal in sheet "Groceries Needed".
Case "Chili" = Chili is the header of column D in sheet named "Recipes".
User enters Chili in first InputBox.
User enters B in second InputBox.
Want to copy the Chili ingredients listed in column D of sheet "Recipes" to column B of sheet "Groceries Needed".
However, next week Chili may be in column F of sheet "Groceries Needed" but the ingredients for Chili will always be in column D sheet "Recipes".
Code as is returns Case Else.
Thanks.
Howard
Option Explicit
Option Compare Text
Sub Graba_Grub_Dub()
Dim myMeal As String
Dim ColmyMeal As String
myMeal = InputBox(Prompt:="What Meal...?", _
Title:="DINE TIME", Default:="Your Meal here")
'MsgBox myMeal
ColmyMeal = InputBox(Prompt:="What Column...?", _
Title:="The Column", Default:="The Meal Column Here")
'MsgBox ColmyMeal
If myMeal = "Your Name here" Or myMeal = vbNullString Then Exit Sub
If ColmyMeal = "The Meal Column Here" Or ColmyMeal = vbNullString Then Exit Sub
Select Case "myMeal"
Case "Chili"
Sheets("Recipe").Range("D3" & Range("D" & Rows.Count) _
.End(xlUp).Row).Copy Sheets("Groceries Needed") _
.Cells(Sheets("Groceries Needed") _
.Rows.Count, "ColmyMeal").End(xlUp).Offset(1, 0)
Case Else
MsgBox "NaDa Good myMeal"
End Select
End Sub
First InputBox... myMeal = a header in sheet named "Groceries Needed".
Second InputBox... ColmyMeal = the column of myMeal in sheet "Groceries Needed".
Case "Chili" = Chili is the header of column D in sheet named "Recipes".
User enters Chili in first InputBox.
User enters B in second InputBox.
Want to copy the Chili ingredients listed in column D of sheet "Recipes" to column B of sheet "Groceries Needed".
However, next week Chili may be in column F of sheet "Groceries Needed" but the ingredients for Chili will always be in column D sheet "Recipes".
Code as is returns Case Else.
Thanks.
Howard
Option Explicit
Option Compare Text
Sub Graba_Grub_Dub()
Dim myMeal As String
Dim ColmyMeal As String
myMeal = InputBox(Prompt:="What Meal...?", _
Title:="DINE TIME", Default:="Your Meal here")
'MsgBox myMeal
ColmyMeal = InputBox(Prompt:="What Column...?", _
Title:="The Column", Default:="The Meal Column Here")
'MsgBox ColmyMeal
If myMeal = "Your Name here" Or myMeal = vbNullString Then Exit Sub
If ColmyMeal = "The Meal Column Here" Or ColmyMeal = vbNullString Then Exit Sub
Select Case "myMeal"
Case "Chili"
Sheets("Recipe").Range("D3" & Range("D" & Rows.Count) _
.End(xlUp).Row).Copy Sheets("Groceries Needed") _
.Cells(Sheets("Groceries Needed") _
.Rows.Count, "ColmyMeal").End(xlUp).Offset(1, 0)
Case Else
MsgBox "NaDa Good myMeal"
End Select
End Sub