Move data from offer sheet to database sheet

MartijnK

New Member
Joined
Feb 20, 2019
Messages
1
Dear Experts,

I am looking to create a macro that enables me to move selected data in various cells from an "offer" sheet to a rows in "database" sheet.

I have data in row 26:31 under constant headers where i input data on the offered products, i.e. grade, production year, chemicals, price, volume, etc.
Where need be i add rows or remove rows depending on how many products are offered.

I would like to have a macro where i can click a button and the offer data is moved to a database. Each complete row form 26:31 should appear as a separate row on the data sheet. The trick is that for each row in the database i would need to information from following cells to be added cell B15 has drop list to select the company name, cell K15 has offer date, cell E36 has the payment terms. This to allow to filter the database by customer, data, etc.

Hope someone on the forum can point me in the right direction. With thanks in advance.

Regards,
MartijnK
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
When you move data from Excel to Access, there are three basic steps to the process.


three basic steps


Note: For information on data modeling and relationships in Access, see Database design basics.


Step 1: Import data from Excel to Access
Importing data is an operation that can go a lot more smoothly if you take some time to prepare and clean your data. Importing data is like moving to a new home. If you clean out and organize your possessions before you move, settling into your new home is much easier.


Clean your data before you import


Before you import data into Access, in Excel it's a good idea to:


Convert cells that contain non-atomic data (that is, multiple values in one cell) to multiple columns. For example, a cell in a "Skills" column that contains multiple skill values, such as "C# programming," "VBA programming," and "Web design" should be broken out to separate columns that each contain only one skill value.


Use the TRIM command to remove leading, trailing, and multiple embedded spaces.


Remove non-printing characters.


Find and fix spelling and punctuation errors.


Remove duplicate rows or duplicate fields.


Ensure that columns of data do not contain mixed formats, especially numbers formatted as text or dates formatted as numbers.


For more information, see the following Excel help topics:


Top ten ways to clean your data


Filter for unique values or remove duplicate values


Convert numbers stored as text to numbers


Convert dates stored as text to dates


Note: If your data cleaning needs are complex, or you don't have the time or resources to automate the process on your own, you might consider using a third-party vendor. For more information, search for "data cleansing software" or "data quality" by your favorite search engine in your Web browser.


Choose the best data type when you import


During the import operation in Access, you want to make good choices so that you receive few (if any) conversion errors that will require manual intervention. The following table summarizes how Excel number formats and Access data types are converted when you import data from Excel to Access and offers some tips on the best data types to choose in the Import Spreadsheet Wizard.


The Access Text data type stores alphanumeric data up to 255 characters. The Access Memo data type stores alphanumeric data up to 65,535 characters.


Choose Memo to avoid truncating any data.


Number, Percentage, Fraction, Scientific


Number


Access has one Number data type that varies based on a Field Size property (Byte, Integer, Long Integer, Single, Double, Decimal).


Choose Double to avoid any data conversion errors.


Date


Date


Access and Excel both use the same serial date number to store dates. In Access, the date range is larger: from -657,434 (January 1, 100 A.D.) to 2,958,465 (December 31, 9999 A.D.).


Because Access does not recognize the 1904 date system (used in Excel for the Macintosh), you need to convert the dates either in Excel or Access to avoid confusion.


For more information, see Change the date system, format, or two-digit year interpretation and Import or link to data in an Excel workbook.


Choose Date.


Time


Time


Access and Excel both store time values by using the same data type.


Choose Time, which is usually the default.


Currency, Accounting


Currency


In Access, the Currency data type stores data as 8-byte numbers with precision to four decimal places, and is used to store financial data and prevent rounding of values.


Choose Currency, which is usually the default.


Boolean


Yes/No


Access uses -1 for all Yes values and 0 for all No values, whereas Excel uses 1 for all TRUE values and 0 for all FALSE values.


Choose Yes/No, which automatically converts underlying values.


Hyperlink


Hyperlink


A hyperlink in Excel and Access contains a URL or Web address that you can click and follow.


Choose Hyperlink, otherwise, Access may use the Text data type by default.


Once the data is in Access, you can delete the Excel data. Don't forget to back up the original Excel workbook first before deleting it.


For more information, see the Access help topic Import or link to data in an Excel workbook.


Automatically append data the easy way


A common problem Excel users have is appending data with the same columns into one large worksheet. For example, you may have an asset tracking solution that started out in Excel but now has grown to include files from many workgroups and departments. This data may be in different worksheets and workbooks, or in text files that are data feeds from other systems. There is no user interface command or an easy way to append similar data in Excel.


The best solution is to use Access, where you can easily import and append data into one table by using the Import Spreadsheet Wizard. Furthermore, you can append a lot of data into one table. You can save the import operations, add them as scheduled Microsoft Outlook tasks, and even use macros to automate the process.


Step 2: Normalize data by using the Table Analyzer Wizard
At first, glance, stepping through the process of normalizing your data may seem a daunting task. Fortunately, normalizing tables in Access is a process that is much easier, thanks to the Table Analyzer Wizard.


the table analyzer wizard


1. Drag selected columns to a new table and automatically create relationships


2. Use button commands to rename a table, add a primary key, make an existing column a primary key, and undo the last action


You can use this wizard to do the following:


Convert a table into a set of smaller tables and automatically create a primary and foreign key relationship between the tables.


Add a primary key to an existing field that contains unique values, or create a new ID field that uses the AutoNumber data type.


Automatically create relationships to enforce referential integrity with cascading updates. Cascading deletes are not automatically added to prevent accidentally deleting data, but you can easily add cascading deletes later.


Search new tables for redundant or duplicate data (such as the same customer with two different phone numbers) and update this as desired.


Back up the original table and rename it by appending "_OLD" to its name. Then, you create a query that reconstructs the original table, with the original table name so that any existing forms or reports based on the original table will work with the new table structure.


For more information, see Normalize your data using the Table Analyzer.


Step 3: Connect to Access data from Excel
After the data has been normalized in Access and a query or table has been created that reconstructs the original data, it's a simple matter of connecting to the Access data from Excel. Your data is now in Access as an external data source, and so can be connected to the workbook through a data connection, which is a container of information that is used to locate, log on to, and access the external data source. Connection information is stored in the workbook and can also be stored in a connection file, such as an Office Data Connection (ODC) file (.odc file name extension) or a Data Source Name file (.dsn extension). After you connect to external data, you can also automatically refresh (or update) your Excel workbook from Access whenever the data is updated in Access.
 
Upvote 0
What is the nature of the database you want to insert values into? Is it an Excel workbook? Some other program (please tell us what it is)? Thanks.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top