| 1. |
Solve : help with Excel macro? |
|
Answer» I am designing a “basic” database in work and having trouble with some macros trying to get the post-production information from that worksheet to the correct row in the database worksheet i cannot doDoes that "correct row" vary each time you update the database? In other words, it could be row 500 one time and some other row the next time? Did you create the macro using the VB editor built-in to Excel? Can you post the code in the macro here?yes that row changes each time, ie the FIRST production run record would have reference 1, the second submit of production data would have ref 2 etc the below was created in VBA. the fist part finds the first empty cell and pastes the data from pre-production into the database spreadsheet for ease i have removed 95% of the coding to give chance to read all on one screen! i am looking at doing exactly the same function with the post-production details, without finding the next empty cell, instead pasting to a specific row as determined by the operator (ie post production form has "enter DB ref No here" cell which i would like the macro to select, find that value in column A, activate that cell, then take the values from post-production worksheet and paste using similiar coding below (offset) to paste into the correct row Sub test4temp() Application.ScreenUpdating = False ' test4temp Macro ' 'selects the last cell in column A and moves to the next cell Sheets("Database MkI").Select Range("A1").End(xlDown).Select ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select 'adds +1 to the previous cells figure ActiveCell.FormulaR1C1 = "=R[-1]C+1" 'select, copy and pastes the Objective/Customer details Sheets("job card").Select Range("B5:e5").Select Selection.Copy Sheets("Database MkI").Select ActiveCell.Offset(0, 1).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'select, copy and pastes the PROJECT Number details Sheets("job card").Select Range("B3").Select Selection.Copy Sheets("Database MkI").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste 'select, copy and pastes the details of who submitted the job Sheets("job card").Select Range("B30").Select Selection.Copy Sheets("Database MkI").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste ......etc for many more variables End SubI'm not sure I'll be able to help you resolve this. Let's see whether someone else has some suggestions. And, I'm going to suggest you register http://www.excelforum.com/ and post your question there.ok thank you for your time Tooooo complex for MS Excel, tooooo problematic. You should start over using MS Access, there is where your project belongs. Quote from: alexK on June 10, 2009, 09:45:17 AM You should start over using MS Access, there is where your project belongs.Good point. I totally agree. Quote i have a worksheet with a pre production formWith Access, pre production data could be one table and post production data another table. The third part could be another table or query derived from the first two tables. Soybean, Right you are with those tables! Having worked with Mainframe IMS Data Bases (heavy duty stuff) for decades, MS Access has a short learning curve. MS Access has surprisingly infinite possibilities to solve complex problems. Ms Excel has limited scope, and is sometimes frustrating. It is not really designed to do that kind of stuff. Learn from me! thanks but i am simply following the instructions from my line manager......will consider it but no one in this team has any experience with access so not a favoured option |
|