oops...heres the file...
Main Topics
Browse All TopicsHi, I am new to Excel Macros and would appreciate some help on a simple VB Macro Code.
Basically I would like to copy information from Cell "c" to Cell "b" based on what is entered in cell "a". I have attached the Workbook I am trying to make this work on:
Specifically:
In Worksheet "QTO" Column A: Type
If I enter "S1" I would like to copy information from Worksheet "Details" according to the corresponding type.
So if I entered in S1 then QTO: Short Length & Long Length would be filled in correspondingly.
I would appreciate any help with this topic.
Thank you
Nathan Lee
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Albert, thanks for the input. I think I need to mention that I am very beginner in terms of Macros. I got to the VB editor from excel and then copied the code. Saved it and when I went to run the macro, it wasn't listed.
Same thing happened when I tried to run the macro from the file you attached. I'm on Excel 2003 if it matters.
Again thanks for the help!
Nathan
Nathan,
Albert's code is designed to run automatically when you change a cell in column A - you don't need to run it yourself. The code has to go into the worksheet code module (right-click the worksheet tab and choose View Code) to work and it won't appear in the macros dialog as it's not a macro as such.
All points to Albert please as I'm just clarifying (hopefully) a bit!
Rory
Thank you Rory,
As Rory stated, the code runs by itself. In the file I uploaded just enter a value in column A of QTO sheet, then press "Enter" (or Return) and the macro will run by itself.
If you would rather have a macro that you have to manually run, let me know...that is easy to do, but just so you will know, I will be gone for about 14 hours so I I won't be back until tonight.
If you have any questions, just ask...Rory or I will help you out
:-)
Albert
Nathen,
Be sure and see my last comment, but just a little more info to get you going...
Code that is put in a worksheet module inside one of the worksheets events will automatically run whenever that event happens for that worksheet, (there are also workbook events that cover the entire workbook, but you can get into that later).
The code I offered was put into the worksheets Change event of QTO sheet, which means any time a change is made on that sheet only, the code will run. The code checks first to see if the target cell (cell that gets changed) is in column A. If it is, then it searches column A of the "Details" sheet for that value. If it is found, then the next 2 columns of QTO sheet are made equal to columns B and C of Details sheet of the row where the value was found in column A...
There are many events for a worksheet, but I don't have time to explain that now...I gotta get going...I'll be back to check on this question tonight...
:-)
Albert
I am neophyte with macros but wanting to learn. This question piqued my interest. I see the suggested solution works to bring in the correspondeing data for X Spacing and Y Spacing (columns B and C data for the corresponding A data in the Details sheet brought into columns B and C of the QTO worksheet).
However the question also asked how to have the Short Length and Long Length data (columns D and E in the QTO worksheet) filled in. I do not see where the Short Length and Long Length data are stored as a value or a formula to be found and/thus I do not see this part working. Author or Experts, do you know how to solve the second part of the question?
I also wonder why the author didn't just use simple Lookup formulas for his QTO worksheet.
For example, a formula in the QTO worksheet's cell B2 of:
=IFERROR(VLOOKUP($A$2,Deta
Would say Type not found if there is an error else fufill my formula of looking at the value I put in A2 of the current sheet (say I type S1) and display the corresponding value found (150) in the table. I used worksheet address references for the table range but could have simplified by naming the range.
Thank you.
The second part would just be an extension of the first - i.e. grabbing two more columns - assuming the data were there.
I assume the formulas were not used either because the OP wanted a fully automatic solution, or did not want formulas but rather hardcoded values.
Note also that the question specified Excel 2003, so the IFERROR function can't be used - you need the wordy IF(ISERROR(formula),"error
HTH
Rory
Nathen,
Thanks for the points and the grade! I hope you got it to work the way you wanted it to work.
fxzmama,
Thanks for your comment. Just wanted to let you know, I did consider formulas, but the asker specifically asked for a macro, so that's why I did it that way, (although I'm not that good with formulas anyway). I might not of got it exactly the way the author wanted, but the exact details were hard to figure exactly what he wanted because there was no Short length or Long Length columns in the QTO sheet. The 2 columns I used were the only two that were on both sheets....didn't know what else to do until the author made a comment back, but he apparently figured it out or liked the way it was...
:-)
Albert
Business Accounts
Answer for Membership
by: ahammarPosted on 2009-04-20 at 19:42:46ID: 24190439
Here is a macro in the sheets change event that will enter the values from columns B and C in the details sheet into the QTO sheet if you enter a value in column A of the QTO sheet.
If you put this in the sheets change event of the QTO sheet, it will do what you want I think, but only for columns B and C.
Your file is also attached already working...
Just enter a value in column A of the QTO sheet...
:-)
Albert
Select allOpen in new window