I wanna ask something about VBA macro excel. i have a database in workbook excel. I wanna input data (call) some cell from database workbook in new workbook. so, do you know how to call them ?
I wanna ask something about VBA macro excel. i have a database in workbook excel. I wanna input data (call) some cell from database workbook in new workbook. so, do you know how to call them ?
You want to use a macro like this:
Sub get_data()
Dim Wb1 As Workbook
'Dont update the screen - makes it work faster
Application.ScreenUpdating = False
'Open the other workbook
'Input the FULL path to the file, including its extension
Set Wb1 = Workbooks.Open("C:\sample.xls")
'You can do whatever you want here with the other workbook - it is now open.
'This just copies some cells.
Wb1.Sheets(1).Range("A1:A10").Copy
'Close the workbook from which we just got some data and make sure not to save it in case accidental changes were made to it.
Wb1.Close SaveChanges:=False
'Turn on screen updating again - makes Excel usable
Application.ScreenUpdating = True
End Sub
This will copy some cells by default but you can do anything with the data and then put it into the other workbook.
There is a tutorialfor this macro and it explains things in more detail.
This is basically what you need but if you need more help, then update your question and provide some sample files and more information.
this is my DB:
and this is my new workbook as engine that will running the program.
my question is, when i write the code in my new workbook (B4) i wanna the quality values will show in cell C4 until G4 automatically depend on my database. Please help me. Thank you..... :)
Best twittalinee,
You don't need VBA to get this result.
I changed your files a little bit.
I made two tables. One in each file.
"Quality.xlxs" contains table "tblQuality"
"Engine.xlsx" contains table "tblEngine"
The cells in column "No." you can fil in a number that exist in "quality.xlsx".
The other columns contains a formula "Vlookup"
Make shure both files are opened.
Ad a new line in "engine.xlsx" by filling in a number in the cell unther the last cel in column "A".
If the number exists in "tblQualitiy", the other values appear.
I already filled in some numbers in "tblEngine", to let you see that the values are equal to te values in "tblQuality"