Code To Generate Data Table Based On Variables

Aug 26, 2008

I was trying to use the VBA code to generate a data table:

Private Sub createDataTable(WS As Worksheet, initialRow As Integer, numCol As Integer, numRows As Integer)
Dim initialCell As Range 'specify the upper left cell
Dim RefCell As Range 'the reference cell on the caculator sheet

'activate source sheet
ActiveWorkbook.Sheets("Calculator").Activate
Set RefCell = ActiveSheet.Cells(2, 3)
WS.Activate
Set initialCell = ActiveSheet.Cells(initialRow, 1)
initialCell.offset(numRows, numCol).Select
Selection.Table ColumnInput:=RefCell
'the calculation should be automatic, if not, then calculate
WS.Calculate
End Sub

and it kept giving me an input celll not valid error on this line: Selection.Table ColumnInput:=RefCell the thing is, I have defined RefCell as a range object, so it should be OK rite?

View 4 Replies


ADVERTISEMENT

Copy Input Data To Output Table Based On Variables

Mar 20, 2008

For what I'd like to do, the attached workbook actually represents 3 worksheet. one input sheet and two output sheets (output1 and output2)

I plan to use command button " CommandButton1" on input sheet to start the calculations

Here's what I want to do after pressing the " CommandButton1" :

1. start with case 1 and find the value of Input A to Input J from input table using Vlookup and paste those values to respective palceholder for inputs in blue colour area above the input table for each input.

2.for empty cell in the input table paste 0 (zero)

3. after this will give results for case 1 inputs on sheets "output1" and "output2" on basis of formulas used for each output

4.then copy the results for case 1 inputs from sheet "output1" and "output2" and paste them on "input sheet " in Output table (its below Input Table) next to case1

5.Do this for all cases (in actual workbook there will be more than 100 cases)

View 9 Replies View Related

Generate A 6 Digits Code Based On Filename And Time Of Generation?

Aug 20, 2009

I need to enter a revision string into a file.

Basically, I need to combine the filename and its generation time and then encode it into a string (i.e. a 6 digits HEX code or 6 digits using [0-9][a-z][A-Z]) so it would generate a pretty much unique revision number.

So, is there any function that you can think of that would do something similar?
If not, what is the best to tackle this?
Generate a CRC or md5sum?

What would be in your opinion a quick and efficient way to solve this tricky one?

View 10 Replies View Related

Macro To Generate A Line Graph With Coloured Pointers And Lables Based On Table

Sep 30, 2009

column A = Date : 01/02, 07/02, 14/02, 21/02, 28/02 (x-axis : shows when the table is updated)
column B = project: x, x, x, x, ,x (name of the project and trend line)
column C = Delivery Date : 01/05/2009, 08/05/2009, 20/05/2009, 30/05/2009, 28/02/2009 (plotted on the graph)
column D = Status : Green, Amber, Red, Green, Blue (status of the project. the points should be the same colour as is described in the table)
column E = Comments: original, delay, supply, out of money, on track, delivered-wow! (these comments will pop up if the user holds the cursor over a point)

NB Y-axis scale : 01/01/2009 to 31/12/2009 with increments of 14 days. this will be the same scale used for all projects.

Date Project Delivery Date Status Comments
01/02 x 01/05/2009 Green original date
07/02 x 08/05/2009 Amber delay supply
14/02 x 20/05/2009 Red out of money
21/02 x 30/05/2009 Green on track
28/02 x 28/02/2009 Blue delivered-wow

So id like the macro to draw the line for project x based on the 'delivery date'. The points should be coloured according to the 'status' column and when you hover the mouse over the point the data lable will show up taking info from the 'comments' column.

Would it be possible to create a macro that will be able to generate this graph automatically. I have a few projects id like to do the same thing for.

View 14 Replies View Related

Generate Table With Internal And External Data?

May 23, 2014

I have a workbook that need to call for external data (this is information from January till May) from another workbook to manage it. I get this external data as a Tabla_A that needs to be updated continually because the extenal workbooks is adding information constantly. However, now i have to incorporate a specific range of old information (information of December, 2013) before the external data in the same Table_A. This last information wont ever change and needs to be incorporated to analize de information from December till Now.

The problem is when I insert the December information as new arrows at the beginning of Table_A, later I update the table and this old data is remplaced automatic by the external Data range. For that reason, I'm wondering to know if there is some way to have one Table_A with a static range of arrows (december) and another range of arrows (January onwards) that is updatable.

View 1 Replies View Related

Generate Text File From Data Table

Jan 21, 2009

I have a table made up of 4 columns and variable number of rows. Column A has 8-digit number; B has 8-digit number; C has text up to 40 chars; D has a number with two decimal points. I would like to generate or replace a text file in csv format containing each row's data EXCEPT where column D value (number with 2-decimal points) is 0.00.
Using Excel 2003.

View 4 Replies View Related

Macro Code Create Pivot Table Based On Dynamic Source Data

Nov 28, 2006

The "Sum" sheet can change its number of rows. The pivot table is based on it. I'm having trouble with the SourceData portion of the code in my macro ....

View 9 Replies View Related

Generate Table On Another Sheet Depending On Input Data?

Apr 15, 2014

I am tracking business hours of various business locations. I would like to be able to enter the businesses operating hours on the "overview sheet" and, based on those hours, have a table generated on another sheet that "autofills" based on the date entered on the "overview sheet". For example:

I would enter the operating hours of the business on the "overview sheet" and it would look something like this:

Day
Open
Close

[Code]....

I want a table for each day created. I would then manually enter the data for the "Ranking" column. The issue is that I have numerous location I want to do this for and all with varying hours of operation. It is very tedious to manually create the tables.

View 9 Replies View Related

Use Mail Merge From Table To Generate Data In Line Graph?

Jun 25, 2009

I want to generate a letter to parents that shares reading fluency data from an excel spreadsheet into a table and a chart. I got the info to post into cells in the table through mail merge. (sample below) Now I want to make a matching line chart to visually show the student's growth over time. I want the data on the chart to change according to the data I put in the cells in the table through mail merge. Is this possible?The data in the cell that says "Cory" and the "88, 100, 112" are placed in this table through mail merge. I want to now be able to take just Cory's information and display it as a line graph. If I highlight those cells and choose "insert a table" it doesn't work.

FallWinterSpring4th grade standards
70-110 WPM85-120 WPM100-140 WPMCory
88100112

View 1 Replies View Related

Generate Lagged Dummy Variables

Mar 27, 2009

I need to generate a series of variables that model for events that occurred in previous days. If you look at the spreadsheet, you will see that on row 10, U01 = 1. This occurred on 1/13/2009. I need to generate the values for 1 Day Lag U01 - 15 Day Lag U01.

This means "1 Day Lag U01" = 1 for each row if in the row below it, U01 = 1. "2 Day Lag U01" = 1 for each row if 2 rows below it, U01 = 1. I manually entered in what this should look like in column AJ to AQ (it is only for 8 days though). how create a formula to do this. I need to do this lag model for all the binary var between C to AI on a 15 day period for 445 companies, so an explanation of how the formula works would be great.

If possible, can the formula end and restart for each company so row 1996 doesn't take on the value of row 1997, which is a different company. If this is too difficult, don't worry about it as I can just manually modify the last few rows of each company.

View 4 Replies View Related

Two Variable Data Table - Both Variables In Rows?

Nov 29, 2013

I'm interested in creating a two variable data table with the two variables in the top two rows.

I'm aware that two variable data tables are usually done in an array with variables in the top row and leftmost column. However, as there are multiple outputs to the variations that I want to make it makes sense to have the variations in the two top rows.

View 8 Replies View Related

Solution/altenative To Data Table Using >2 Variables

Feb 9, 2010

Is there a way to test out a formula using Excel that has more than 2 variables? (If only 2 variables, I would use a simple data table). The formula I am testing has 50X50X20 variables (and as a subset, each variable has 2500 lines of assumptions!). I don't need to see all the results, only the result that produces the highest result. For simplicity (if someone has an answer) let's assume 3 variables are A1, A2 and A3. Formula is in A4 and formula is A1+A2+A3. Assuming A1 can be 1 to 5 and A2 same , A3 same, the long hand calc is for me to run a data table using variables in A1 and A2 the fixing A3 (as 1)..note maximum result....then run data table again using variables in A1 and A2 and changing fixed value in A3 to the number 2...and so on and so on....in this simple example I know the max result would be 15, but much more difficult in my spreadsheet test.

View 9 Replies View Related

Generate List Of Data Based On Sort Data From Another Worksheet

Feb 25, 2014

I have Sheet1 "MASTER" and Sheet2 "Area1" and Sheet3 "Area2" etc...

My MASTER sheet has a list of employee names and the areas they work in. I have employees working in different areas, and I want to pull a list of employee names from the MASTER working in Area1 (sorted on the MASTER sheet) to column A on Sheet2, then pull a list of employee names working in Area2 to column A on Sheet3, etc...

I want it to do this in such a way that if I add an employee to Area1 on the MASTER data, it will populate that employee in the Area1 Sheet.

So basically, I'm looking at one column on the MASTER sheet to see if the area matches. Then looking at another column on the MASTER sheet to get the name. Then taking that name and transposing it to a new sheet corresponding to the area they work in.

I've attached a sample sheet. I want Column A in the Area1 sheet to reflect all names that show up on the Area1 LIST on the MASTER sheet, and nothing else. I'm using VLOOKUP to pull the rest of the data from the MASTER table.

There is a new sample workbook up now. Couldn't update it sooner due to site outage. I've removed irrelevant data to improve readability and focus on what I'm trying to achieve. Again, the main issue is scraping column E from the Master, and populating a list of all employees who match certain values in Column E on the Master in Column A of the other tabs.

View 2 Replies View Related

Which Are The Variables In The Code, Delete All The Rows Which Have Data In?

Oct 28, 2008

This vba code will delete all the rows which have data in. At present it starts on A2 (so doesnt delete anything above A2. Which part of the code in red would I need to change for it to be A3 and which would I need to change for it to be B3.

View 5 Replies View Related

Unzip Code - Works Without Variables, Breaks With Variables...

Feb 5, 2009

Unzip Code - Works without Variables, Breaks with Variables.... This has been driving me bananas...

I have the

View 2 Replies View Related

Locating Important Columns In A Table Of Raw Data - Setting Variables Using A Loop

Feb 22, 2012

I need to be able to locate some important columns in a table of raw data (the column locations are not fixed).

I would like to identify the locations (based on the heading values in Row 1) and store them as Public variables. The Match function works fine for this, however I'd like to make a simple loop to set these variables (opposed to repeating the function for each).

In the example below, I can't figure out how to reference "List1(Count)" as the name of the variable I'm trying to set.

Code:

Public Field1 As Long, Field2 As Long, Field3 As Long 'The column numbers will be stored here
Sub FindFields()
Dim List1(3), List2(3)
Dim Count As Long
'Public variables (declared above)

[Code] ......

So after running FindFields(), the Test1() macro should give "1 - 2 - 3" (for example) as the locations of the fields in Sheet1. But currently this doesn't work.

View 2 Replies View Related

Automatically Generate Template Sheet Based On Previous Data

Apr 17, 2014

I currently have a large spreadsheet that multiple people fill out. Each person fills out all the information in a row. At the end of the row, I would like a button that says "Generate Form" so that when clicked, a new sheet automatically opens with a template form that I created and is already filled out with the information that was just inputted into the spreadsheet. Also, there are four different template forms that could generate. For example, there are forms A, B, C and D. If the user inputs "B" into the first column of the row, then when he goes to click "Generate Form", a new sheet is created with all the information filled out in Form B.

View 3 Replies View Related

Find Correct Data Based On 2 Variables

Oct 19, 2006

I have a project that looks at a table of train schedules for a range of dates. The data is formated so that arrivals and departures are on the same row but differnent columns. The dates are to the right and the grid is completed with the number of arrivals for a paticular day. I have created a formula that looks at the data and returns the arrival time for that date. It worked fine until the schedule was altered so that the same train could arrive at 2 different times on 2 different dates. So train 976 arrives at 4a on some days and 5a on others. In the example Ihave posted train 976 has 2 passengers arriving at 5a but the formula shows 4a. Is there a way I can have the formula return the correct time based on the day of the month? I should point out that the same problem could exist for departures.

View 8 Replies View Related

Code To Move Data From Entry Table To Historical Table By Date

Mar 14, 2014

In the attachment you will see an example of what I am trying to accomplish. What I am trying to do is find VBA code that is either specific to this worksheet or in a macro. When the sheet is opened I enter a date in B2. I then enter data into A7, B7, and C7. What I would like to happen is when the data is entered into A7, B7, and C7 the sheet goes and finds the same date that I entered in B2 and copies that data from A7, B7, and C7 into F7, G7, and H7.

View 2 Replies View Related

Looping Through Databased And Retrieving Data Based On 2 Variables

Feb 6, 2009

Another VBA problem I am having to need help with...

Andy Pope and DonkeyOte graciously helped me with the first stage here:

http://www.excelforum.com/excel-prog...-a-time-2.html

where I was trying to loop through 1000 records at a time and retrieve data from my Oracle database based on a single Field ID.

This is the code that ended up working...

View 14 Replies View Related

Excel 2007 :: Sum Data Based On Row And Column Variables

Sep 25, 2012

I'm working on a workbook that will combine a cash flow report by category and also by date. The categories can change (which I think is the easiest part) but so also can the frequency of data. For instance, you choose how you want to see the data, monthly, quarterly, annually and this will change the Row that the data should be summarized based off of.

Examples:
1) Annual: Sheet 1: Row = Rental Revenue and Column = 2001. I want to pull from sheet 2 all of the Rows that are mapped to Rental Revenue and all of the Columns that are mapped to 2001.
2) Quarterly: same idea but by quarter.
3) Monthly: No issue, just a SUMIF.

In Sheet 2 I have added a mapping at the top of each column for the Quarter, Year or Month that should be included in the Sheet 1 heading Row.

I tried using a sumproduct on both row and column using the whole data set underlying, but this did not work.

"=SUMPRODUCT(1*('Sheet 2'!$A$9:$A$140='Sheet 1'!$C28)*('Sheet 2'!$E$9:$GA$9='Sheet 1'!E$27)*('Sheet 2'!$E$10:$GA$140))",

It gives me a #N/A result.

I have tried to attach a table of what I am trying to do.

Sheet 1
Choose Frequency
1
Annual

[Code]....

View 4 Replies View Related

Transfer Data To Separate Tables Based Two Variables (date And Site)

Oct 28, 2009

I have a spreadsheet where raw data is entered ("RAW_DATA") for each month it is collected. There are 7 questions that are tallied and each of those responses are transfered to a separate data table for analysis (7 individual tabs within the spreadsheet). I'm currently manually data entering the values from the raw data tab to the other seven tabs.

I would like to have VBA code that could transfer the data from one month ("RAW_DATA") onto the other 7 tabs based on the date and facility identified in the raw data tab. I have not attempted the VBA since I do not know where to start with searching on two variables.

View 2 Replies View Related

Passing Variables And Values Between Sheet Code And Module Code

May 13, 2009

I have some buttons in different sheets in an excel file, each button has its own code, that is the reason I can not move the code related to each object to another location (sheet or module).

And I have one piece of code in Module1 (Auto_load) in order to execute automatically this routine every time file is opened. Inside "auto_load" routine I initialize some values of some check buttons,options buttons and positions of some objects in diferent sheets, but I can not pass the value of variables between Module and Sheet's code even when I declare as public variables and/or function.

I have the following structure: ...

View 11 Replies View Related

Data Connection From Web / Web Query Returns Code Instead Of Selected Data Table

May 31, 2014

A web query I am trying to use to bring an online data table into my worksheet is broken. Now, instead of returning the data table nicely into my worksheet, it imports the code of the webpage, instead, and turns my worksheet into a mess.

The query used to work but there was recently an "upgrade" to the program that populates the web table and the query no longer works and just returns the code for the page, instead. I can see the html code for the table in all of the code it returns but I really need the table to import cleanly into excel.

I can't talk to the people who changed the web program.

View 3 Replies View Related

Programmatically Generate Table From Textfile?

May 19, 2014

I am trying to create a table (listobject) from a textfile datasource on a shared drive.

How to get this over the line, I have the following code which I am struggling to finish.

Code:
Sub Testing
Dim wb As Workbook
Dim ws As Worksheet
Dim ws2 As Worksheet
Dim lo As ListObject
Const Pathway As String = "F:Scripting"
Const File As String = "Log.txt"

[code]....

View 1 Replies View Related

Generate New Report From Pivot Table?

Jun 16, 2014

I have a pivot table based on sales data and I need to know the 3 salespeople that had the highest sales during the current fiscal year versus the last fiscal year.

I have tried manipulating the pivot table but I keep getting the error message: "the following system error occurred: the requested name is valid but no data of the requested type is found".

View 1 Replies View Related

Marco To Generate Pivot Table

Jun 26, 2007

I am trying to create a pivot table macro to append to the end of an existing macro I already created which formats the data prior to the pivot table.

Here's the Pivot table setup info if if I was setting up the pivot table manually:

1) Column C (column header row = "D C/D") to be PAGE
2) Column G (column header row = "MN") to be ROW
3) Column A, B and D (column header rows = "TT", "NT", and "CC") to be COLUMN

Sum of Column E (header GA (DA)) and Sum of Column F (header TFA) in DATA ...

View 9 Replies View Related

Generate Weekly Reports From Table

Oct 2, 2007

I would like to create one page (sort of like a form) to use to collect specific weekly payroll related data for multiple employees and be able to automatically transfer that data to its own weekly data page based on the week date, and then also automatically post specific data to each individual employees' total pages. While I am self taught and comfortable with formulas I do not yet have a lot of experience with VBA and am just now recognizing and exploring the true power of Excel so I don't always yet see the best way to accomplish my goal.

My current way of doing this is to reuse the same form page. I plug in the data for each employee that week, it calculates, I print it out, and then I manually update each employee's total page for that date. As I do this I lose the previous week's details. I would like to retain a page for each week's details in addition to having each employee's total pages. Is this possible or is there a better way to accomplish my task?

View 2 Replies View Related

Code To Generate 'date' Ref Number

Apr 24, 2008

each time a button is clicked I want a new ref number to be produced and displayed on my userform.
I can't however create the code to generate this ref number.

In column A of my 'sweeplog' worksheet is where I want the ref number to be placed. This ref number is simply made up of today's date - in format ddmmyy eg 240408 for today 24th April 2008 then add the number '1' if its a new date or the next number in coulumn A if not.

for example In column A I have these 3 ref numbers
A2 = 2404081 (24th April 2008 plus 1 as this is the first ref used today)
A3 = 2404082 (as above but with 2 added)
A4 = 2404083 (as above but with 3 added)

now tomorrow the next ref number that would be shown in column A (after the user clicks the button) would be as follows.....

A5 = 2505081 (25th April 2008 plus 1 as this is first ref used on 25th)

I am able to get this unique ref number to show in my userform but can't figure out how to produce the code to generate it

View 9 Replies View Related

Generate Items In Second Table Without Having To Enter Manually

Jul 15, 2013

How to use I have these two tables, like the picture shows.

How to get the "food" items to generate in the second table without having to enter them manually?

For example, if I were to enter 3 food items out of 10 entries, on the second table, those food items would appear.

excel.png

View 1 Replies View Related







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