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


ADVERTISEMENT

Building A Dynamic Database

May 23, 2006

I have a workbook with 3 worksheets titled “Numbers”, “Letter” and “NumLtr DB”.

The “Numbers” worksheet is a dynamic listing of numbers in Column A, which also is a Dynamic Named Range using the formula: OFFSET(' Num'!$A$1,0,0, COUNTA('Num'!$A:$A),1)

The “Letters” worksheet is a dynamic listing of letters in Column A which also is a Dynamic Named Range using the formula: OFFSET('Ltr'!$A$1,0,0,COUNTA('Ltr'!$A:$A),1)

I need a macro to duplicate in column A, on the worksheet titled “NumLtr DB”, the first number down as many rows as are needed to equal the full count of letters, and then, in column B, list each letter in succession. This process needs to be repeated once for succeeding each number and then stop.

View 9 Replies View Related

Dynamic Feed Excel Table From SQL Database?

May 8, 2012

Call center stats: I have a SQL database which is LIVE. I would like to create a live report on excel from this database. (update my excel table automatically)

View 6 Replies View Related

Create Summary Page From Dynamic Database Pull

Mar 8, 2013

I am currently pulling information from a database into Excel. In column A is a list of dates that vary depending on how many days I decide to pull. On any given day there are options to which car will be driven and it is random and there are attributes associated with that drive such as below. If the car was not driven the data pull inputs "No Data" or a "0". On any given day up to three cars can be driven but it is still possible that only one will be driven. This is shown in the second table below. I'd like to be able to create an automated summary table such as the first table below. The summary table should be organized by date and show what cars were driven and their attributes. I know this seems simple but in reality I have six different cars and up to 10 attributes for each car and will be pulling months at a time. The only thought I have had is to do a for loop that checks every individual cell but I am not sure how to implement that.

Car
Miles
MPG
Car
Miles
MPG
Car
Miles
MPG

[Code] .....

View 1 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

Run SQL Queries In Excel Against Database Using Macro?

Jan 29, 2014

I have sql queries in spreadsheet column and which needs to run against Db2 database daily and then update the result back to spreadsheet. This is tedious process and could there be a way to create a a macro using VB which performs the following?

1. connect to db2 database

2. take the sql query one at a time from every row and then run against database

3. Obtain the result and then update it back to last column of the spreadsheet.

View 3 Replies View Related

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 View Related

Macro: Filter Database By Date

Dec 2, 2006

My problem is modifying existing macro code (see below) provided by Jim.

Sub WriteDetentionRegister()

Application. ScreenUpdating = False

ClearDetentionRegister
SortDataBase
AutoFilterDataBase1

Dim rDataRange As Range
Set rDataRange = DBase.Range("rDataBase"). CurrentRegion.Offset(1, 0)

rDataRange.Resize(rDataRange.Rows.Count - 1, rDataRange.Columns.Count - 2).Copy
DREG.Range("rdetreg").Offset(1, 0).PasteSpecial xlPasteValues
DREG.Activate
With Selection
.Sort Key1:=Range("rOffDate"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
End With
DREG.Range("rdetreg").Select
Application.CutCopyMode = False

End Sub

At present the writedetentionregister macro filters the database sheet for a positive balance (in column H) and pastes these records into another sheet called Detention register.

Is there a way of also getting the writedetention macro to count 7 days from the offence date (the E column of the database sheet) and ONLY on or after that date write that record to the Detention Register Sheet?

The workbook containing the database & the detention register sheets are enclosed.

View 9 Replies View Related

Macro That Will Export To Database In Access

Jun 21, 2007

know the code to export a file to data base?

View 6 Replies View Related

Sum Database Totals But Only If 2nd Database Greater Than X Number

Oct 17, 2013

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

View 5 Replies View Related

Macro Copy From Invoice To Table Database?

Feb 22, 2014

need macros :

Copy From Sheets ("PO")
Copy D7 & H7
Copy C11 : H25 (Only Active Cells)

Paste To Sheets ("Sheet1")
D7 & H7 = Column A & B
C11 : H25 = Column C, D, E, G, H

database.xlsm

View 4 Replies View Related

Database Query Macro- Password Prompt

Feb 26, 2009

I have created an Excel sheet that retrieves data from a ODBC source. I have created a macro using macro recorder to refresh the data by re-connecting to the database. However, the connection requires a password prompt and when the macro is run, you are still required to enter the password.

Is there anyway to make the macro so that the password is automatically entered and the user will just have to press a button to fully run the query update?

View 2 Replies View Related

Simple Macro- Exporting Data From A Database

Nov 21, 2006

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.

View 9 Replies View Related

Excel - Macro To Copy Invoice Data To Database

Aug 1, 2014

Following macro code is for copying Excel Invoice Data to Excel Database. Also cleans the specified cells after copying. Its working Perfectly.

But there are some issues that should be solved.

Problem 1: It copies empty cells(""), formula based cells and blank drop-down list.

Problem 2: After copying it cleans formulas too. Formulas must be remain their.

View 2 Replies View Related

Macro To Migrate Access Database To Spreadsheet/Workbook

Sep 7, 2006

I would like to know how to migrate an Access database to a spreadsheet, I do not mean Exporting.

More specifically, the migration is conditional. The spreadsheet only needs a few fields from specific tables in the database. It is basically a data dump, however, the magnitude of the amount of information that I will be handling will be far too time consuming and not within the scope of the budget to do this all by-- Exporting-->Copy-->Paste method.

Also, changes often need to be made "The night before..." so the macro will need to be able to ran possibly a number of times to update the additional data or changes in data.

In my research I have found a few snipets of VBA code from the MSDN website as well as some other websites, however none of it seems to be consistent with one another and ultimately results in it not working.

Is this possible?

View 9 Replies View Related

Excel Macro To Lookup Edit Data In Online Database

May 18, 2012

I'm working on an Excel based product. As part of the security process I would like to require the user to enter a product id key into excel. Then the spreadsheet would compare the entered value to some kind of online database to verify the id key is valid. Finally, the spreadsheet would update the online database so that the id key is no longer functional. How easy is this to do?

I know verifying that the id key is valid is fairly simple.

Here is my biggest issue: How to get Excel to update the database and of course what form would this database take. Maybe its a table on a webpage, or google docs. Again the issue is how would I be able to update the table.

View 1 Replies View Related

Macro And Conditional Formatting: Formats The Data That Is Pasted Into It From An Access Database

Dec 2, 2008

The macro firstly formats the data that is pasted into it from an access database, then it does some calculations to determine when 10 working days from a specific date is, and when 20 working days from the date is (these go in new columns at the end of the data). The macro will also add new columns which say "Not resolved" if there is no date in the Resolution column, "Yes" in the "10 working days met?" column if the condition is met and the same for 20 workings days in a different column. As the colouring etc takes a long time I really wanted to add as conditional formatting to the macro!

how to attach a spreadsheet here then I can show you what the outcome we want is. A point to note is that there is not a set number of rows each time we do this, and I don't just want 1 cell to be coloured - I want to specify which cells in the row are coloured depending on the results in another cell on that row.

View 2 Replies View Related

Excel 2010 :: Macro To Copy 3 Cell Values And Append To Existing Database File

May 14, 2014

I'd like my macro (in an Excel 2010 workbook) to copy values from three worksheet cells and append them to an existing Access or SQL database file -- without having to leave my Excel spreadsheet or open any other programs. The database file simply needs to be appended. Keeping a running list. That file isn't being used for anything else, we can set it up however is necessary to do this.

For example, Excel cells A1, A2, and A3. Representing Job Name, Job Number and Job Total.

how make VBA do this(in SIMPLE terms)? Or give me a link of where to look or what to search for? I understand VBA but not Access or SQL.

View 1 Replies View Related

Dynamic Range In A Macro

Nov 17, 2011

I am trying wihout suceess to create a range to copy in a macro each time the macro loops. This is thus a dynamic range. My failed attempt is listed below. How is this done?

ColumnAdjust=2
For I = 1 To 282
Range ("B5").Select
Range(ActiveCellOffset(0,ColumnAdjust),ActiveCellOffset (0,ColumnAdjust+1))
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
.
.
.
ColumnAdjust= ColumnAdjust=2
Next I

View 4 Replies View Related

Dynamic Date In A Macro

Dec 12, 2007

I have the following code in my macro which open a file where the suffix changes everyday with the date of the day:

Dim FN As String
FN = Format(Now(), "YYYYMMDD") & ".xls"

Workbooks.Open Filename:="S:BSGWFDIMyfile " & FN

My question: What code should i write to open a file where the date= D-1 where D= business day (from monday to friday only) ? Basically i want to open the file with yesterday date (Myfil20071211.xls)?

View 9 Replies View Related

Macro - Dynamic Fill-Down To Last Row

Jul 1, 2006

I've recorded a macro where I have selected two adjoining cells in Row-9. I double-clicked at the cells to fill-down the formulas to the end of the range. However, the macro recorded: Selection.AutoFill Destination:=Range("H9:I152")

Of course, I will be adding and deleting rows from this worksheet. The next time I run the macro my range may only be to row 80 or it may be up to 200. How can I make the macro dynamic, so the AutoFill goes from H9 to "the end of the range"?

View 2 Replies View Related

Dynamic Range In Macro

May 28, 2007

I am attempting to create a dynamic range within a macro.

Each week, a list of performance factors is recorded for employees. The macro is about to do an Advanced Filter to create reports based on user-provided criteria. Since there is new data every week, the range used for the Advanced Filter is dynamic. The code for the Advanced Filter refers to a range entitled “Database.” My problem is in defining “Database.”

It is currently 534 rows and 8 columns, starting at A1.

The relevant portion of the macro currently reads:

Sub Check1()

ActiveWorkbook.Names.Add Name:="Database", RefersToR1C1:= _
"=OFFSET('Loan Officer History'!$A$1,0,0, COUNTA('Loan Officer History'!$A:$A),8)"

Range(Database).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"J1:Q2"), CopyToRange:=Range("J5:Q5"), Unique:=False

End Sub

When running the macro, the debugger stops at the line which starts "ActiveWorkbook.Names" and tells me “Run-time error ‘1004’. The formula you typed contains an error.”

View 3 Replies View Related

Macro To Search A "database" In A Different Workbook And Copy Whole Page When Matched

Jul 14, 2009

I need another big macro to search a different workbook "database" for a match. An example of what the "drawing number" will look like that the macro will search for is;

View 5 Replies View Related

Macro For Dynamic Sheet Name Reference?

Jun 23, 2012

I've got the following code:

VB:
Application.DisplayAlerts = False
Worksheets("WildCard").Delete
Application.DisplayAlerts = True

I'd like the "WildCard" to pull from a value in a cell whereby I can run a button macro that, when pushed, deletes the tab/worksheet named "WildCard". For instance, if I wanted to delete "Sheet3" I would type "Sheet3" into, say, cell C3 and then press the button to run the macro and "Sheet3" would be deleted. How to I refer the macro to cell C3? I currently have a macro that inserts/names a sheet based upon a cell reference and macro button. I'd like one that can delete in the same way.

View 7 Replies View Related

Macro To Sort Dynamic Range?

Jun 6, 2013

I have a Ranking tab that has the persons name, weeks, months that subtotal into 2 columns, MTD and YTD. I have set up with 2 Macros to sort based on two columns based on their selection of MTD or YTD.

What I did not take into consideration is if a person was added at the bottom of the list.

Is there a way to modify this to include rows that may be added?

VB:
[SIZE=4]CODE HERE[/SIZE]
VB:
[B]Macro1
[/B]Sub SortYTD()

[Code].....

View 8 Replies View Related

Dynamic Worksheet Event Macro?

Nov 21, 2013

i currently have a workbbok that i have a very simple worksheet event macro that will filter a seperate sheets contents to the corresponding entry number. is there any way to make a dynamic event macro that will filter my second sheet depending on what cell is selceted on the first.

for example record 1 on sheet 1. if cell L1 is selected it will filter sheet 2 to to record 1, record 2 on sheet 1, if cell L2 is selected it will filter sheet 2 record 2 and so on. this list of records will continue to grow and i cant think of any way other than what i currently have, which is to make each filter macro for every cell.

is ther a better way example of CODE HERE

VB:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Address = "$L$5" Then
Call Filter1

[Code]....

View 2 Replies View Related

Macro For Dynamic Pivot Table

Jun 23, 2014

I am trying to make a dynamic pivot table using VBA. Unfortunately, Im not very good.I have a set of data with variable number of rows and variable number of columns and I need to make a pivot table. Need to select this data from sheet - Master, where the first data entry starts in cell A1. of the data in the sheet, i only need the name and age title In the pivot table fields -

ROWS needs to contain - name
COLUMN needs to contain - Age
Values need to contain - count of Age

After this is done, since the data will be dynamic, the pivot table will also be dynamic. i need to copy the pivot table data and paste it in another sheet so that I can do some filtering. The filtering part I think i can do my self.

View 3 Replies View Related

Dynamic Macro To Lock Cells That Contain Any Value

Feb 10, 2014

I'm currently using this macro:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Rng
Dim MyCell
Set Rng = Range("A1:AA7672")
For Each MyCell In Rng

[Code] ....

The problem is that it is not dynamic and it's super slow. The larger my range is the slower it operates and right now it's almost unusable.

The workbook I am using gets touched by 10 different people and I want to prevent tampering. I want for the workbook to be, when protected, have all the blank cells editable and once a value is inserted, it cannot be edited again and not work so unbelievably slow.

View 5 Replies View Related

CountA - Dynamic Range - Macro

Sep 6, 2007

I recorded this macro based on a column with a drop down window in which data has been filtered .....

View 12 Replies View Related







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