LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Somewhat complex code to copy data from one sheet to another

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:D" & 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex Compare Values, and Copy/Paste if in One Sheet but Not Oth ryguy7272 Excel Programming 2 August 19th 09 06:49 PM
Copy and paste subtotals-complex data range error Teri Excel Discussion (Misc queries) 1 March 6th 09 04:06 PM
Complex Question. Index/Match then Copy/Paste to Summary Sheet ryguy7272 Excel Programming 3 December 9th 08 06:34 AM
Copy all data into one sheet and insert origin data... code amend... [email protected][_2_] Excel Programming 3 September 15th 08 02:54 PM
How to Copy Data from on field to another? Complex? [email protected] Excel Discussion (Misc queries) 0 March 13th 06 04:05 AM


All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"