Macro VBA To Update Database Sheet

May 15, 2013

Basically I want to set up a workbook, which will have a sheet called "Database" and then sheet1.

I want to use sheet1 as a "add to database" sheet, where users will simply dump in some data into sheet1 and the marco will format it so it matches the headers of the data base and then it will add/update the database sheet with the info (and new info if its new) from sheet1.

Here it is in pictures.

This is basically what the database sheet will look like (but much much much more rows of data)

As you can see this is a job database with some columns for POD, Connote, etc.

This is what the update sheet1 will look like when someone dumps some new data in (I can easily write a macro that formats it to match the database)

So basically I want the VBA to merge this sheet1 data into the database sheet, as you can see, there is simply a few 1's added to various columns for "Car Dudes" and "Robin Manufactures" but "Jimmys Lollies" row is completely new and not in the database.

So the marco would basically match up either the Job number or the HB number of the rows in sheet1 and if there is a match in the database sheet it will update the cells data, and if there is no match it will add the row to the database sheet.

The issue is the data in sheet1 might not be fully complete all the time, it might only have a job number and not a HB number, it might not have a client name or whatever. Basically the data users dump into sheet1 will come from many different reports, many different sources, what I'm trying to do is essentially merge all this data into a common formatted database sheet, for further working.

So in a nut shell, a macro to:

1. Match Job/HB numbers in sheet1 with rows already in database sheet and update row accordingly with any new data.
2. Add any new Job/HB rows from sheet1 into database.

View 4 Replies


ADVERTISEMENT

Speeding Update Process Of A Database

Jan 15, 2007

Did not want to hijack Jonny's thread about ways in which to update and streamline code to make it run faster. The update speed of my first attempt at a macro is woefully slow - 5 minutes for 2.5K records. I was wondering if some of you more knowledgeable folk could look at my code and make suggestions as to how it could be modified to run faster.

When I ctrl-break out of it I usually end up in a private sub that concatenates columns A & B in Column C (see below). When it resorts the database it must keep triggering this concatenate sub which (I think) is slowing things down.

Concatenate Private Sub:

Option Explicit

Private Sub CommandButton1_Click()

End Sub

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub ......................

View 9 Replies View Related

How To Update Daily Report In Database Format

Apr 3, 2013

I have a 2 sheets in a workbook by the name Entry and DataStore. I am entering the daily data in Entry sheet and then manually updating the data in DataStore sheet. Is there a macro to automate this.

I have uploaded the sample file with the expected output comments to the below link:

Free large file exchange service without size limits.

View 8 Replies View Related

Update Record In Database If Exists Otherwise Insert

May 5, 2013

I am Working on a Query to Update Record in the Database if Exists Otherwise Insert. I have 2 tables in the database Receipt table and Inventory Account Table.

For Receipt Table there is Form which is used to Insert Data into the Receipt Table(SQL TABLE). Behind the Button Click Event with the Receipt Table Insertion Query I Write a Select Query to Get data from Inventory Account Table Group By Part Number and Location in a recordset.

Code:
objmyrecordset.Open "select [Part Number],sum([Quantity Received]) as TotalQuantity,[Move From] from [5_PO_RECEIPT_TABLE_DATABASE] group by [Part Number],[Move From] ", objMyConn, adOpenStatic

objmyrecordset.MoveFirst
Do
strSQL = "select Count(*) from [Inventory_Account_Move_Table] where [Part Number] = '" & objmyrecordset![Part Number] & "' and [Location]= '" & objmyrecordset![Move From] & "';"

[Code] .......

I used the Above Code to Complete my task. The Problem is It is Adding the Correct Values into the Inventory Account Table But It is Not Updating the Previous Records. it sum all the Values in Receipt Table based on Part Number and Location but it insert this record in New Line. I want it to Update the Previous record for same part Number and Location.

View 9 Replies View Related

Find Most Recent Files And Update Database

Jun 16, 2008

I have database that needs to be updated automatically. Thus far, I have written a macro that will take out and add all necessary data from a file I open, however I would like to write a macro that will find the most recent files and use them to update the database. I would need the macro to 1) Find the folder name that corresponds to the part number in the database, and open that folder, 2) find the most recent file addition to the folder 3) open that file and run the macro that I've already written.

View 9 Replies View Related

Update The Source Data For The Pivot Table In Database

Jan 7, 2009

I would like not to have to update the source data for the pivot table in my database. I've read that you can solve this by using a Dynamic Named Range and using that as the source for the pivot table. That way the pivot table will expand as new data is added to the database. The formula I used to create the DNR is:

View 7 Replies View Related

Import External Data. Update Link For New Database

Dec 12, 2006

In an Excel sheet i have set up a link to an Access database query (select query) using the Import External Data method. The data is store sales by week, arranged in a pivot table layout (stores as rows, weeks as columns). As time goes by, the database will be updated for new weeks sales, and i would like to refresh the data and the new weeks automatically appear in the Excel sheet, in subsequent columns.

At the moment, the only way i can seem to get this to work is to open up the link in MSQuery and manually select the new weeks from the Access query. i have set the parameters to overwrite cells with new data rather than insert new data. i'm sure there is a way to do this, as it feels like it would be a common thing to want, but i can't seem to find an answer anywhere!

View 5 Replies View Related

Excel 2013 :: Macro To Update New Sheet?

Jun 23, 2014

I've got a spreadsheet that pulls data from a SQL server.

I'm looking to have a button on the first sheet that extracts the data from SQL and inserts it into sheet 2 of spreadsheet. The data connection from SqL is working fine but when I click on the button sheet 2 is blank.

View 1 Replies View Related

Macro To Update Links In Active Sheet Only

Jun 15, 2009

I have a workbook which has links to another excel workbook (source). This workbook has many sheets -all exact copy- with different names. I changed startup prompt (edit->links) to "dont display the alert and dont update automatic links". Then I recorded a macro for updating links (from source) and assigned this macro to a button. What I want to do is when I click this update button I want links to be updated only on the active sheet that Im on. My problem is, when I press this button, it updates all links including other sheets (basically whole workbook).

My current macro is (I dont know coding but I tried changing ActiveWorkbook to ActiveSheet but it didnt work):

Sub update()
ActiveWorkbook.UpdateLink Name:= _
"C:Documents and SettingsAlperDesktopExcelsource.xls", Type _
:=xlExcelLinks
End Sub

View 2 Replies View Related

Macro To Update Data Sheet Based On Entries From Another Worksheet

Mar 7, 2013

I have a worksheet designed to look like a form. That worksheet pulls data from an "Application Data" worksheet using INDEX and MATCH formulas. That part works great. The user enters an Application number on row 8 and it populates all of the other cells. In fact, in cell O7 (not pictured), I have it generating the row number the data came from (based on a MATCH function).

Here's my question--if they go in and change a value in one of the other cells, they should be able to press an "Update" button. That will then kick off a macro that goes to the "Application Data" sheet, finds the row that has the Application Number (from row 8) and updates the values based on what the user entered on this form.

How do I write the statement that selects the row based on the Application Number?

View 5 Replies View Related

Userform Won't Load Info From Database Sheet To Invoice Sheet

Feb 16, 2008

I have a list box that I'm using to pull customer information from my "Customer" sheet to my "Invoice" sheet. I can actually open, select, and close the userform. However, I can't get the macro to put the information into the specified location on my "Invoice" sheet.

Here's my code so far:

Private Sub Cancel_Click()
Application.ScreenUpdating = False

Unload Me

End Sub

Private Sub customer_Change()

End Sub

Here is the "Customer" sheet I'm pulling the info from:

And here is the location on the "Invoice" sheet that I'm trying to direct the userform to:

And here's my userform just for reference:

The userform works perfectly until I press the OK button. That's when I get the error.

View 9 Replies View Related

Copying Data And Pasting Data To Update Database

Jun 3, 2006

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 Related

Macro To Move Data From Data Entry Update Master Sheet Using Formula To Allocate

May 12, 2013

I am working on a project and would like to see if there is a solution for it. i have a workbook that has data entry that is summarized at a master level but I need to automatically use a formula to update another sheet after clicking an udpate button. The data from the data entry sheet needs to be allocated to all the lines that has the same master item based on the formula. A test workbook is attached ...

View 1 Replies View Related

Update Table On Another Sheet With Information On ACTIVE SHEET Based On Column Search?

May 14, 2014

What I have is a sheet that is copied periodically from some source sheet, and on this sheet is a table. This sheet is called "Onsite Checklist Template" and it's table is titled "Checklist". I also have another sheet called "Loggers and Initial Notes" which has a tabled titled "Record", and then finally a title sheet call "Proj Details".

To clear this intro up - The sheets, in their order, is: "Proj Details", "Loggers and Initial Notes", "Onsite Checklist Template". The tables: "Record" on "Loggers..." and "Checklist" on "Onsite..."

When the user wants to make a new site visit, he/she fills in the requested date and then selects a button on "Proj...". When this button is selected, it copies the table data on "Record" and puts it on "Checklist", then inserts a new worksheet tab, always in the 3rd position (the title is based on the site visit date in which the user entered), which is a copy of "Onsite...". Now we have another sheet with a table called "Checklist1", and upon another new site visit, there will be another worksheet with "Checklist2", and so on.

On the "Onsite..." worksheet, there is a button on it which also gets copied with the worksheet so that every new worksheet has this copied "Checklist ???" and this button. I'm looking for a macro that, when the button is selected, will bounce the active sheet's table "Checklist ???" off of "Record" and make changes as needed.

"Checklist ???" data range is B11:M20 (the header is on row 10); "Record" data range is B29:Q78 (the header is on row 28); Column headers are titled the same, just that "Record" has 4 extra columns, 3 in the middle and 1 on the end. "Checklist ???" columns 1-12 to "Record" columns 1-7, 10-12, 14-15. The search criteria is the 4th column in both tables ("Trk #").

I need the macro to do the following:If it finds a match, then update "Record" as needed with data from "Checklist ???", changing whatever cell is different in the row that contains the matching "Trk #", so long as the cell on "Checklist ???" is populated (i.e, if a cell on the target row of "Record" has a value, but it's blank on "Checklist ???", then "Record" wins; if it's blank on "Record", but populated on "Checklist ???", the Checklist wins. If both populated but different, then Checklist wins.If a "Trk #" exists on "Checklist ???" but is not on "Record" then add the line to "Record" (the 1st empty row, table size remains)I see no need for any "delete" at this time.

My concerns: The last column on record (column #16) is the filtering column for the worksheet copy event and needs to be left alone (it's formulated to produce a "Yes" or "No")I would like the ability to adjust table sizes if needed without modifying the macroThe table rows on "Checklist ???" will not be changed, deleted, or altered in any way by the macro.

View 2 Replies View Related

Update A Cell Value From A Previous Sheet After Copying The Sheet And Renaming It

Nov 21, 2009

I have copied a sheet, moved it to the end and renamed it with a date that is in cell "A1"

Now after that process is finished I need it to update the date in cell "A1" of the newly created sheet with the next day's date.

I am stuck however referring to the previous sheet to update the date value in "A1"

View 7 Replies View Related

Tranpose Sheet Of Database Up To Down?

Jul 27, 2006

i have a sheet of database which is aligned from left to right (row). now i want to "tranpose" it from up to down. how can i do it?

View 4 Replies View Related

Pull Names From A Database To A Particular Sheet?

Feb 11, 2014

I'm looking to pull names from a database to a particular sheet based on what info is displayed in the database. I have six names listed in the database with a league type and position. I have three different tabs at the bottom for where the info is supposed to pull depending on the player type.

For example, I want all six players to pull to the 'Mixed' tab and populate the appropriate area based on their position. Next I'd like the 3 players with 'AL' for their league type to populate only on the AL tab and likewise for the players with 'NL' for the NL tab. Not only do I need the players to pull to the appropriate tab but i also want them to populate in the right position within that tab.

View 8 Replies View Related

Transferring Database To Lead Sheet?

Jun 19, 2013

I have a database that has been created in Excel.

It has columns such as Permit #, Permit Date, Project Name, Contact Name.

I have to call on each of these projects, and I am trying to create a Lead Sheet that will make it much easier as opposed to having to go to the database, and handwrite the information into a lead sheet.

Such as there being one lead sheet per project. That way, I can just use the lead sheets as opposed to using the excel database.

I've seen it done with excel and word used together where each heading (permit #, permit date, etc.) was copied into a lead sheet essentially doing all of the writing for me automatically.

View 4 Replies View Related

How To Print Cover Sheet In Front Of Database

Jan 21, 2013

I have 36 pages of names, addresses & contact info ETC that I want to print. I have a printer that offers a cover sheet in the print setup.

My list of names addresses ETC takes up two full pages of paper for each name. There are 16 columns across the sheet that contain data for each entry. I would like to print this so that I can turn the pages like an address book and see all of the data for a given set of contacts on each two page spread. So what I need to do is print the first half of the contact info on the inside of the first page and the second half on the next page and so on.

How can I set this up?

View 4 Replies View Related

Use TAB To Moving Another Cells And Save Database In Another Sheet

Jul 28, 2013

I have 2 sheet in Excel. Sheet1 I rename main page and Sheet2 I rename database. In my main page I use tab key to be moving from within 3 cells (B5,B6,B7) that are different to include data. How the data may be stored in sheet database. When we fill data in main page how to evacuate data to fill second data.

View 1 Replies View Related

Userform Database: List Records In A Sheet As Well As Search For Records In A Sheet

May 7, 2006

example of a database user form that will allow me to list records in a sheet as well as search for records in a sheet. I know excel has a built in feature for this but it is menu driven and I need something that is button driven and will allow me to resize the form layout. I was not able to figure out how to do that with the built in form.

View 7 Replies View Related

VLookup - Update Sheet A With Updates From Sheet B?

May 5, 2014

I have 2 excel sheets A and B

Sheet A has full list of (3000) of user names - First Name , Last Name and Email address

Sheet B has few UPDATED users (200) of user names from above list with UPDATED email addresses ( with First name , Last name and email address)

How should I update Sheet A with updates from Sheet B?

View 3 Replies View Related

How To Take Data From One Sheet To Automatically Update Another Sheet

Feb 2, 2014

i have two sheets, sheet 1 is a list of some items i sell on my website and the stock quantity.sheet 2 is a list of what my supplier has in stock.i want a quick way of my stock values on sheet 1 in column G to match the stock values on sheet 2 column E.

the product codes are the same (sheet 1 is column E for product codes, on sheet 2 the codes are in column B).

on my website (sheet 1) the products size options (column J) are more detailed than that of my suppliers (sheet 2 column F)

for example, my sheet (sheet 1) will say on some items for example MEDIUM: DRESS SIZE 10-12 but my supplier sheet will just say medium also my sheet (sheet 1) will say ONE SIZE or PLUS SIZE where as my suppliers (sheet 2) will be blank however this means that there is only one stock value to update anyway as there is only one size option

is it possible to magically make sheet 1 match the relating stock values from sheet two?

so on sheet 1, item 10035 Child Gangster Suit in size small would change from 7 to 13 and item 10001 Jumbo Syringe would change from 11 to 20

i would also need the updated values on sheet 1 to be highlighted so i know if any have been missed, for example my supplier may have stopped supplying an item in medium but obviously i would still have a stock value for it on my sheet so therefore that value wouldnt be updated so i would need to be made aware of this so i can then remove the option (which has to be done manually) on my website...

View 2 Replies View Related

Lookup Value From Database And Get List Of Matching Values To Another Sheet

Sep 21, 2013

I want to find the corresponding Disc Codes from a list and copy them in the DiscName column in the summary sheet. some lab names will have more than one Disc codes so when I run the macro it should bring up all the relevant Disc Codes matching with the Lab name to DiscName column.

Col 1 col 2 col 3 Lab name Disc Name(say abcd) xxxx yyyy zzzz ppppand

The list looks something like this.

Col 1 Col 2 Lab name Disc nameabcd xxxxxabcd yyyyyabcd zzzzzabcd pppppbcda
qqqqqbcda rrrrrbcda iiiiibcda jjjjjbcda kkkkk

View 1 Replies View Related

Update Data By Ado - Change/delete Data And Then Run Macro For Update Data In Source Spreadsheet

Dec 6, 2006

I have one source spreadsheet, where are columns NAME, DATE. I read these data by ADO to other spreadsheet, where I can change/delete data and then run macro for update data in source spreadsheet. The problem: In source spreadsheet is column "NAME" and column "DATE", with values e.g. "Joseph"; 1.1.1980. I read this data to other spreadsheet, then I delete in it value 1.1.1980. When I run macro Update, it messages error.

Sub UpdateItem
...
.Fields.Item(1).value = activecell 'activecell value = "Joseph"
If Not isempty(activecell.offset(0,1)) Then
.Fields.Item(2).value = activecell.offset(0,1).value
Else
.Fields.Item(2).value = "" 'I tried Empty and 0 too but when I read data again then, it displays 0.1.1900, nothing works
End If
...
End Sub

It seems that in source spreadsheet has data in column "Date" format Date and when I try to update data in format String ("") in source spreadsheet by Update macro, it messages error. When I used

.Fields.Item(2).Value = Empty
' or
.Fields.Item(2).Value = 0

after rereading data it displays 0.1.1900 What I want to get is that if the cell with date (in other spreadsheet) is empty, the cell in column Date in source spreadsheet after updating will be blank (contains no values).

View 2 Replies View Related

Creating Images Database Where Pics Are In Excel Database

Mar 31, 2004

I 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.

View 4 Replies View Related

Database Named Database And Return A Time In Column

Nov 7, 2008

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))

View 9 Replies View Related

Dynamic Database Macro

Jun 21, 2006

By adapting a worksheet macro obtained previously via Ozgrid, I built a workbook that dynamically produces a database, in a worksheet titled “NumLtrWBS DB”, based on all possible combinations of what is listed in column A of three 3 worksheets titled: “ Num”, “Ltr” and “WBS, respectively. The macro, named “NumLtrWBS", works wonderfully, until I add a row at the top of each list to contain a column header. The unchanged macro includes the column headers in the “produced” database. When I change the macro by altering the variable definitions to begin at A2 rather than A1, it still includes the column headers in the “produced” database. How should I change the macro so it doesn’t “produce” the column headers in the database worksheet?

View 4 Replies View Related

Excel 2003 :: Extract Information From Spreadsheet Database Into Another Sheet With One Trigger?

Nov 27, 2012

I used to use Excel many many years ago for all my basic business databases and pivot table reports (so was at a basic competency level) and want to use it again but it has been quite a while and I can't remember how to do the following.....

I want to build a database of sales and purchase info in say 'sheet 1' - let's say 30 different headed columns and then many lines of different information under each column.

In 'sheet 2' I want to create an invoice template of my own design (I can do easily) for printing.

This template will need to extract say 10 bits of information from a particular row and then put them in a certain place on this sheet.

How can I type in one piece of information in a cell on sheet 2 (say the invoice or line number of the database) and that will then trigger all the other needed information from that particular line in sheet one onto this template?

I know it can be done but for life of me can not remember the formulas to use for these other cells in sheet 2 based on the info put in that one 'trigger' cell

View 4 Replies View Related

Linking Cells For Update On One Sheet It Updates My Last "customer Touch" On A Master Sheet

Aug 24, 2009

I am tracking my sales interactions and am trying to link cells so when I update on one sheet it updates my last "customer touch" on a master sheet. Current formula-

On "sheet1" I selected a cell and used this formula... =sheet2!$b$7

The problem is that I want to keep a history of what was in that sheet 2 B7 cell so i insert a row (making B7 move down and become B8) and enter new info into the new b7. if I go back to sheet1 the formula in the selected cell becomes =sheet2!$b$8 I want it to stay to =sheet2!$b$7 no matter what I do... insert rows, delete rows etc...

in short what i am trying to do is have a cell in sheet1 show my last interaction with the customer and keep a history of in sheet2-infiniti.... with the caveat that my last interaction on sheet 2 etc... is listed first (thus the insert row)

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved