VBA To Get Data From Database.
Jan 15, 2010I am trying to use an excel vba program to get data from a database and then use this data in my program. But i have no clue about where to start.
View 9 RepliesI am trying to use an excel vba program to get data from a database and then use this data in my program. But i have no clue about where to start.
View 9 RepliesI am currently trying to create a database of products for my company. For each product I would like to include an image associated with it. I then want to have on another sheet a place where the user will click an error and be able to cycle through the products. As tehy cycle the associated image will pop up.
What I need to understand is after importing the image into excel, how do I associate that image to a cell so I can reference it in another sheet of the database. I am not concerned with how large the database will get, my pictures are quite small.
I'm trying to lookup a database named database and return a time in column A, based on criteria in cells a1 and b1 on another sheet, A1 would contain a number and B1 would contain a day from mon-fri
eg of Database
A B C D E F G
10:00 5000 Mon Tues
11:00 5000 Wed Thur Fri
and so on
if a1= 5000 & b1=Wed
how can I return 11:00
I have tried index and match =index(a:a,match(a1&b1,b:b&e:e,0))
Trying to use Excel Data List to create a database style report. IE. Originally blank sheet, which is only populated by data containing data matching "filters" input into cells ( say A1 & A2 )
I.e. A1 = Delivery week to be filtered by, and B1 Manufacturer Name
So if I type week "1" into A1 & Manufacturer "Microsoft" into A2, it will show a table only containing data Microsoft, Week 1, and associated data for those lines across the screen.
Week 1
Microsoft
PO number : Date Ordered: Address 1, 2 3 etc....
0011 01/01/13 Somewhere
0015 02/01/13 Anywhere
0213 05/01/13 Nowhere
I know this is much easier with a database, however my manager insists a database cannot be used, and it must be in a spreadsheet format !
I've used a countifs, but I'm having trouble doing a sum in a similar way. I have 2 databases and I will try to explain below. I need the to sum the values of database 1 if the second database is >= 20. So the value I would expect on this example would be 900. I would also like to be able to highlight which ones are elliminated. Such as coloring the text red.
Database 1
Eric 100
Jenny 200
Gina 300
Doug 400
Database 2
Eric 18
Jenny 20
Gina 34
Doug 55
I have a workbook with a database of 15 different products. We receive information with current prices for each of the 15 products on a weekly basis. This info comes in one single worksheet. I have created a different file with one worksheet for each product to track price behavior over time. I need to update these database everytime I get a new report. What I was trying to do is to develop a Macro to copy the data from a "Master" worksheet that includes all 15 products info to the respective worksheet for each product. Information is sorted in columns having the most recent date in the lowest column. I would need the Macro to copy the new data below the last price for each product. I would copy the data into the "MAster" worksheet, then run the Macro who would copy each row and paste it in its respective worksheet in the row rightafter the previous one.
View 4 Replies View RelatedI have spreadsheets supplied by clubs to add data to a database. I am not a spreadsheet user,
Today I have a spreadsheet with the columns A to M repeated in the width of the spreadsheet.
How do I reduce that to one display?
I need to sort a database. In the pic you will see what i have and what i need to do.
example.jpg
Is there a way for an excel macro to open a access database & import a txt file straight to access (without importing to excel first) & then executing some other code e.g. copy query results(which i already have code for)
View 14 Replies View RelatedI have a database sheet with all the data, I want to make a query sheet that display the rows of data when I enter the data in the summary sheet. I have 2000 rows of data and about 24 in type(columns)
So if I enter in cell Hona and Miles 50, it will display all the rows in the database sheet that contain those data...so I assume I would have to insert some kind of formula, or is there a simpler way to do it with out VB/database...
Car Miles PriceGasColor
RaceCar 50 Over1.5Red
Honda 100 Over2.5Black
Lexus 200 Over 3.5Silver
I've "lurked" around the board for a few days now, and I've gotta say this is the most helpful excel forum by far. After wading through a tiny chunk of the thousands of threads on this board, though, I am still having trouble with coding a macro that will do what I need it to do. If it affects anything, I'm on Excel 2002 on Windows XP.
I am currently in a project where I have to go through a database, formatted as thus: ...
I have a spreadsheet that tracks hours for employes and I need to get the data in a different layout to import to a database i'm building. The example spreadsheet has 2 tabs, the first is the format it's currently in and the second in the one I need it in.
View 4 Replies View RelatedI have this macro that will export some cells data to a worksheet. But at the same time I want to export other cells data to another different worksheet. Is it possible?
So far my solution is to use the same macro but with different command button.
[Code] ......
I want extract data from 1 database and I know how to do it with the Pivot Table. Unfortunately, doens.t show it the way I want. I have attached one file with my problem - pls, check sheet RPT.
View 3 Replies View RelatedI'm tasked with looking up part numbers in Epicor's ERP database and entering the labor cost into excel. Is there any way to write a macro or VB program that lokks at the part number in excel, goes into epicor, pulls finds the part number and cut and pastes the cost data.
I have about 30,000 of these to look up.
Tried the below code with minor modification to select file referred from
Open 132 files and copy data into master file
My problem is its not copying the entire data. Copies only few 3 or 4 rows.
Code:
Option Explicit
Public Sub CommandButton2_Click()
Dim Master As Workbook
Dim sourceBook As Workbook
Dim sourceData As Worksheet
[Code] ...........
check out the attached workbook.
I have 3 companies, A, B, and C, split by worksheet.
What i'm trying to do is consolidate all the data on 1 sheet, so it auto populates if new lines are added in the individual company worksheets.
So if a new line of data is added on the Company A worksheet, it will automatically be added in the Overall consolidated worksheet showing everything (so say I have 5 rows of data in each workshet, I want all 15 rows showing in the consolidated), BUT only if it has the following criteria:
That its got some data in Either the 'CF Currency or Other Currency or Amount' columns. If it fulfills any of that criteria, the new line will be added in the consolidated worksheet.
Copy Rows, Meeting Criteria, From Multiple Worksheets & Append To Summary Sheet - This thread has been made by a guy with the same problem as me and the solution for it works for him, but I cannot make it work for mine. I'd guess it would need small modifications but I don't know coding at all.
which databases people are using with importing excel data into a database.
I want to know people's experiences on different databases and suggestions on which database i can use maybe.
On this moment i do everything in excel, but excel is not longer working properly because of large files that need to be connected to 1 or more sheets.
This is the situation now:
VAX (Dos bases database) -> Comma seperated Files -> Importing in Excel -> Linking the data to sheets.
Now I want to have a database where i can do all normal operations to have a good look and the situation of stock status, ordered parts, sales etc. (inventory control)
Who has experiences with databases ? And what are you doing with that database?
I am currently working on a project for college. I have downloaded an example from a website and want help editing some vb code so I can use it in my project.
I have attached the example. As you see there is an input worksheet and the record of what you have already entered. The vb code takes some information from the system such as time and date and the user. All I want it to do is that it takes data from 5 cells I have.
I am no vb expert but I have tried and failed.
I am using the attached code however when my database query does not return any data I dont want the Dim function to perform.
Sub macro3()
Worksheets("Data 1"). Range("I3:BU65536").ClearContents
'declare a variable to hold date
Dim strDate As String
strDate = Format(CDate(Range("startDate").Value), "yyyy-mm-dd") & " " & FormatDateTime(CDate(Range("startDate").Value), vbLongTime)
Sheets("Data 1").Select
Range("A1").Select
With Selection.QueryTable
.Connection = _...........................
I'm trying to write a macro in Excel that will search certain values a Siebel database. I'm already working with a macro to ADD data to the database, so I have all the connections taken care of. But now I need to pull data from it. In looking for how to do this, I see the setsearchspec method that I need to use to set up the search then the ExecuteQuery to run it to get the pointer. But before that, I have to create the referencing object. I've noticed in several examples here and on a couple other sites, these two lines:
Set busObject = SiebelApplication.GetBusObject("Revenue")
Set busComp = busObject.GetBusComp("Revenue")
So here's my question: in all of the examples I've seen, they used "Revenue" as the argument for these methods. Does it really matter what we use there? Or this just essentially a place holder? I've looked at some of the online documentation and was unable to glean an answer from that.
I have inherited a number of databases in work (running Office 2003). It has quickly become apparant that a vast amount of work is duplicated and so i am trying to cut down the data input and therefore the possible errors.......
I have narrowed most of the work down and now have a major worksheet (is that what you call a complete Excel file) named "master database" and several over minor files....
Currently what i am trying to do is to get one of the minor files to auto populate an area of the master database. I will try to explain it below...
1. Minor database has 2 columns with data i require to auto populate the master database. (1 column (B) is called 'off', the 2nd column (C) is called 'on').
2. A number will be inputed manually into either 'B' only or 'B and C' columns, depending on the criteria of the job..
3. The criteria of the job is dictated by column (Z) where the text 'A' or 'ATL' is inputed
4. The master database i would like to add up the numbers inputed as a total from columns 'off' and 'on' and place them into seperate columns 'E' and 'G' of the master database.
5. IF column (Z) shows 'A' then only column (B) 'off' is to be calculated and put into the master database at column (E)
6. IF column (Z) shows 'ATL' then BOTH columns (B and C) 'on' AND 'off' are to be added together and column (G) populated on the master database.....
To make mattters more complex. An expiry date is shown on the master database at columns (D) and (F).
IF column (E) does not exceed 12 by the expiry date, i would like the cell (D) to turn red
IF column (G) does not exceed 10 by the expiry date, I would like the cell (F) to turn red
I already transfer my data from database (excel.xlsm) to an old worksheet (excel.xlsx) with a table by using VBA. Now I want to make this old worksheet become a new file with new file name like yyyy/mm/dd/where. Is that possible?
View 4 Replies View RelatedI am faced with a challenge of identifying all the probable duplicate issue of Id cards for a list of some 50000 students.
There is a list of student names in Column A with associated fields in subsequent columns.
I would like to use either first name or last name as keyword and pull all the data(all the columns) that either partially or fully match the keyword in second sheet.
I have attached a sample workbook for this : STUDENT MASTER.xlsx
I have tried vlookup but it pulls only one data set.
I have created a workbook which both imports data from an access database and exports data to same. Some of the data I need to access is dependent on parameters which the user will change in excel e.g. I need to extract PeriodID (ID for a month end date) based on a date in a speified cell in excel.
MS Query is a very handy way to achieve this as the wizards automate almost everything. However, this workbook will be shared on a common drive on a server (as will the database). Initial testing suggests that the connection and queries I'm making on my machine do not work on other people's machines.
What is the best way to achieve the queries in excel which query data from an Access Database, but will work on all machines accessing the sheet from a shared drive? Is there any way I can avoid writing complex VBA code for this? I have an awful lot of specific queries like the one I mentioned above to perform.
I have created my first user form that puts the info gathered onto a seperate sheet.
We are a garage and its for cars that come into stock.
What I want to do is when we sell a car, have a way of removing the car from the database but recording the infomation that was in the first database and some additional infomation like who sold it and the selling price.
Have the following code:
With iSheet
i = .Range("A" & Rows.Count).End(xlUp).Row
j = .Cells(1, Columns.Count).End(xlToLeft).Column
.Range("A1", .Cells(i, j)).ClearContents
[Code] .......
If I use F9 to pause the code before the sort part in blue, then the data imports into Excel from the database and then subsequently pressing F5 sorts the data as required.
However, if I run the macro in a single pass, the data does not sort. Why it's not sorting as expected and how to make it sort as required?
I have a report (roughly 4000 lines) which I need to rearrange for pivot/power-pivot use.
The structure for each row/record is:
col1 geography
col2 area
col3 customer
col4 product
col5 price
col6-65 monthly sales units - 5 years (columns labelled Jan 2009, Feb 2009 .... Dec 2013)
I want to rearrange the data as:
col 1-5 unchanged
col 6 month (data Jan 2009, Feb 2009, etc.)
col 7 sales units
Currently i have 4000 rows/records (each containing 65 fields). Iwant to end up with 4000 x 60 or 240,000 rows/records of 7 fields each. Is this possible through a data import wizard or VBA routine?
I am exporting data from a database and will want to split up the information into separate worksheets & eventually into separate workbooks.
What I am looking for is a macro code that will automate the cut/paste of information onto other worksheets. I know I can record the macro but the problem is the data sets vary in size each quarter.
What I need is a macro code that looks for a particular phrase and when found it automatically puts all rows undernear (until phrase appears again)on a new worksheet....make sense? The phrase might appear twice or 50 times, so each time it is found the data following will cut/paste.
How do I get data validation to automatically add an entry into its database.
Ex.
If a cell if formated for data validation and I make an entry thats not currently in its database, it enters it into its database.