Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


3 Variable Data Tables?

I have recently discovered the "data table" tool on Excel and have found it to be extremely useful for sensitivity analysis. The Excel help describes how one can create 1 and 2 variable data tables. Now I would like to create a data table using three variables, however. (I would like to vary three different variables and see what effect they have on one formula.) Is this possible with Excel? Can pivot tables be used this way?

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
Use Variable To Name New Worksheets And Pivot Tables I.e. Day 1 Through 7
I am usually able to find the answers to any questions I have by searching the forum or internet. Unfortunately I ran into one that I am not even sure is possible at this time. I have 7 macros like the following. One for each day up to 7. The macros create four pivot tables on the page. I wanted to find out if I could combine it into one macro using variables. Unfortunately every attempt I have made results in an error.

Sub Day1Table1()
Sheets.Add. Name = "Day 1 Tables"
LastRow = Sheets("All Data").Range("R65536").End(xlUp).Row
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"'Day 1'!R1C1:R" & LastRow & "C18").CreatePivotTable TableDestination:= _
"'Day 1 Tables'!R1C1", TableName:="Day 1 Service Alarms" _
, DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTables("Day 1 Service Alarms").AddFields RowFields:="Service"
With ActiveSheet.PivotTables("Day 1 Service Alarms").PivotFields("Service")
.Orientation = xlDataField
.Caption = "Number of Alarms"
End With..............................

View Replies!   View Related
Condensing Tables Of Data
Let's assume, starting at A1, that i have table (8c x 30r)
and lets assume that in each of the columns i have 5 cells filled in with data at random.
What is the best way for me to produce a list of the data in each of the columns without having to go in and delete out all the blanks myself? I.e. i want to reproduce the table but without any of the cells which do not have any data in.

View Replies!   View Related
Compare Data In Different Tables
I need to check data from two tables(A and B). They are supposed to match each other and my job is to check if there's error in it. Each row contains several criteria, and all criteria need to be matched. I need to give a report on the info that

1) contains in table A but not in B
2) contains in table B but not in A
3) contains in A and B but some of these criteria do not match..

I have basic knowledge of VBA. Forget to say, they are in different order. And even after sorted, the name may still unmatch with each other, so can not use formular like "=Sheet1!A1=Sheet2!A1"


View Replies!   View Related
Arrange Data In 16x9 Tables
I have 2 columns of data:
Column A is SKU #
Column B is Bin Capacity

I would like to take each SKU and its corresponding bin cap and arrange them into a 16 column and 9 row table on another sheet.

For example A1, B1, A2, and B2 of the old sheet, should become A1, B1, C1, D1 of the new sheet. Also I need there to be a line gap between each table.

Anyone know how to do this?

This is what I got so far:

View Replies!   View Related
Lookup Data Across Multiple Tables
I want to a macro or a function that can search for the value which corresponds to a cell and copy it to another cell. please refer to the attachment for more detail.

View Replies!   View Related
Frequency In Large Data Tables
I need to find the most frequent number for each name in a large datatable, eg. Name1=12.

ColumnA / ColumnB
Name1 / 12
Name1 / 11
Name1 / 12
Name2 / 100
Name2 / 105
Name2 / 105
Name2 / 98
Name3 / 14
Name3 / 14
Name3 / 2
NameX / ..

Since Pivot tabels cant do the trick as far as I know, i'm clueless of how to proceed.

View Replies!   View Related
Tables - Formulas To Pull Data From
I have a Excel Table that will be sorted/identified by the first column of every row. In the Table, there are numerous columns calculating values for each unique item across the row. This will be a large inventory table. The calculations will adjust based on a unit value of 1, and if the unit value is changed calculations go through the rows

I want to accomplish several things:

1) Pull data to another portion of the sheet based on,
a) Selecting a unique item that comes from a drop down list based on unique item identifier in the table
b) pull values related to the unique item and put in cells near the drop down list (I tried an =if function but did not have any luck
=IF(G1=ZillaRac[Item Name],ZillaRac[MSRP],"MSRP Not Calculated") but it resulted in #value!

2) If possible by selecting my unique identifier, insert a unit multiplier that would go into the Excel Table and adjust the values calculated in the table to be brought back up to the cells in part 1.

View Replies!   View Related
Array Extracting Data From Tables
I've encountered is the spreadsheet attached. Basically I am trying to create a "complex" array (at least it's complex for me lol) to basically extract some values from tables and put them in one together. The array I thought would work is on the table with BRIGHT YELLOW BACKGROUND, whereas the table that could do the same work but more "manually" is with a RED border around it. I know I can do it manually as the red border table shows, but I've been trying all day to make it work with a complex array.

View Replies!   View Related
Creating Tables Correctly To Get Data
I've attached what I've done so far. I'm trying to figure out a way to capture everything. For instance, instead of using separate boxes for the different groups, isn't there a way that I can put the # Registered, # Attendance, % Attendance, % Didn't Attend, Units Didn't Attend, and list the different units, and different groups. I'd like it to be sort of like the very last box where I have the different sessions and the different groups in there, but I'm not sure where I could add the # Registered, # Attendance, % Attendance, % Didn't Attend, Units Didn't Attend, because the last box only formulates the percent attendance for each session by the different groups. I need it to also formulate the # Registered, # Attendance, % Attendance, % Didn't Attend, Units Didn't Attend. Is there a way this can be done without using separate boxes for each group.

View Replies!   View Related
Prevent Data Tables Calculating
I have a file with numerous data tables that slows down the file significantly due to it's large size. I would like to set the calculation method to Manual, but also be able to manually turn the tables on and off so that they don't slow the file down when I hit F9 to calc. Is there a formula or method to accomplish this? BTW, I can't use VBA.

View Replies!   View Related
Pivot Tables 2007 - Selection Data
I have the following code and I can't work out how to fix it. What i want is for the macro to create the pivot table from the "used range" in a worksheet but I want it to be formatted as a 2007 pivot table. The reason I say this I because I have some 2003 code which works very well which is where the idea of this come from but it doesn't seem to work here. I have highlighted the problem in orange, I know the rest of the code works because when I replace the orange bit with

"Raw Data!R28868:C33"
it works.

Sub CreatPivot()
Dim wksdata As Worksheet
Dim rngdata As Range
Dim wksdest As Worksheet
Dim pvtTable As PivotTable
Set wksdata = ThisWorkbook.Worksheets("Raw Data")
Set rngdata = wksdata.UsedRange.........................

View Replies!   View Related
Select Different Data Tables From Cell Selection
In a particular battery sizing workbook I have 3 data tables on each sheet (Sheet2, Sheet3 and Sheet4) The table range is d22:u45, the same on each of these three sheets. What I would like to do is to when any one of three cells (labled "Sheet2", "Sheet3", or "Sheet4") is activated on Sheet1, transfer the data from that reppective sheet table range d22:u45 to the same range d22:u45 on Sheet1. And let me use that data in the Sheet1 worksheet subroutines.

View Replies!   View Related
Pivot Tables Do Not Refresh Contents When Data Is Deleted An
When we create a database in an Excel Spreadsheet and then some pivot tables, we use to copy the spreadsheet with another name, in order to clean the data and update it with another date (for instance, one excel spreadsheet for one BU or country, another one for other bU or country), to avoid creating the pivot tables again and again.

However, when we clean up all the data and enter the new one, on the Pivot Tables fields, you still see the "old data that was deleted"... Do you know if there is a way to delete that data without recretaing the pivot table?

View Replies!   View Related
Combine Data From Multiple Worksheets - Pivot Tables
I am trying to combine sorted data from 2 worksheets to a new work sheet to process further. I have one worksheet with order number, part number, order qty but with different delivery dates. On another worksheet, I have the order number too, part number, the qty delivered. The qty delivered is not always the same each delivery.

My aim is to find out how many are already delivered under a certain purchase order and the balance of undelivered parts.

I used pivot tables to sort out the data but I am stuck here not knowing how to extra the sorted data from the pivot tables to the 3rd worksheet. I will need to match the order number and the part number.

View Replies!   View Related
Automatically Refresh Pivot Tables After Data Entry
This is the first time I’ve tried to use VBA. I’m using Excel 2000. In my excel workbook have 1 sheet called “Cards” in which I Change data in one cell $B$2 (enter a part number) and formulas in this sheet return many values from another sheet “Card Data”. In the “Card Data” sheet, formulas that look through a sheet “Sales Book” and return the data that pertains to the Part Number I entered in the sheet “Cards”. In the sheet “Card Data” there are 3 pivot tables (“PH CALC”, “PH QTY”, and “Pivot Table 3”) that use the Part Number data to show 3 different sets of information. The pivot tables are the source for 3 charts in the “Cards” Sheet.

Problem: Pivot tables don’t automatically refresh. I would like to use VBA code to automatically refresh the pivot tables in the “Card Data” sheet when I change the Part Number in cell $B$2 of the “Cards” sheet, which, in turn, would then update my charts in the “Cards” sheet.

View Replies!   View Related
Summing Data In Pivot Tables That Belong To Different Years
I'm wondering if it's possible to do the following using Pivot tables. I have month period from 1-1-2006 until today by month. Is it possible to have in the pivot table a field that shows the total of 2006 and then another field that shows the total of 2007?

View Replies!   View Related
Macro To Copy Data Within Excel Into Tables In A Word Document
Currently I am going back and forth between an excel document and a word document cutting and pasting values from the excel spreadsheet into tables in word. The task is a regular occurance therefore I wish to create a Macro that can automate this procedure. Both the excel and word documents are fixed templates therefore once a Macro is created it can be applied to all future work of similar nature.

Each table in the word document contains 6 rows of values in a single column. The excel data is arranged in a table that is 6 rows by x number of columns (how ever many sets of values there are for the particular job) therefore x determines how many tables must exist in the word document. I move between the excel and word document cutting and pasting each column into each table. This is not so time consuming if x=10 however on occasion x=100+ and it does take time.

View Replies!   View Related
Macro To Create Pivot Tables And Sort Out Data In Other Worksheet
The first sheet is the row data given to me, the second one is where I want my data to be analysed automatically by macros.

I managed to create a pivot table manually to give me the info I want but then I still have to copy all the results from the pivot table sheet to my analysis sheet.

How can I create a macro able to do all that by it self? I tried to record a macro using the recorder but then when I try to play it it gives me an error straight at the beginning in the definition of the pivot table I think.

An example of what I want the pivot table to do is:
in the first sheet, go in the small table in column K and L, take the value of L1, then in the row data in column A to J, in column C look for the value in L1, once found, look for the value 1 in column J then do the average on the values in column E and put the result in my second sheet in cell F5
then do the same but look for 2 in column J and put it in F8, then 3 in F11, ... until 7 found (the data is in ss.000 and so the results in the second sheet should be formated the same way)
then do the same all over again for value in L2
etc etc etc

this should be done for the 6 values in column L, each having values up to 7 in the J column.

Then I need to do the same for other columns and not only averages but minimums as well but I can adapt the code I think.

View Replies!   View Related
Inter-relating Combo Boxes In Userforms Based On Data In Tables
I have worked out (through reading and what not) how to link a combo box to a range in a worksheet. What I need to do is relate what is selected in that combo box, to another combo box which picks from another range. I have a data spreadsheet called "Offices". It's set up as follows

(Sorry, it's really frustrating trying to format it to a table type thing but you get the gist)

ROW NUM______COLUMN A____________COLUMN B
2_________________________________OFFICE 1
3_________________________________OFFICE 2
4_________________________________OFFICE 3
5_________________________________OFFICE 4
7_________________________________OFFICE 2...............

View Replies!   View Related
Transfer Data To Separate Tables Based Two Variables (date And Site)
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 Replies!   View Related
Variable Data Referencing
I have a word table(s) which I need to paste into excel, its a quotation sheet and this document always has the same basic format. I then need to copy across specification items to another sheet between 2 points in column A ie between points TEXT1 (A25) and TEXT2(A40) so cells A26:A39 in this instance but this can be between 1 or 100 items.

Text 2 is the start of a costing section and wouldn't be transferred.

What i am looking to do is write a formula which will look in sheet1 at column A and find "TEXT 1" at A25 then copy items across until it comes to "TEXT2" at A40 but is flexible enough to cope with various numbers of items.

View Replies!   View Related
Variable Data Into A Drop Down List
Is it possible to have the value in one cell determine which cells to "data validate" for a drop down list?

Example - I have three different Ports of Entry with different arrival dates.

When the user inputs the Port of Entry into a cell can I create a drop down list that shows the data related to that individual port?

View Replies!   View Related
Sum And Weight Average Variable Data
Hi there, been using this for a number of years now, but never had to post a question - I guess most things are already answered - but this one is a bit more tricky.

I want to calculate a totals and a weighted average based on months from a data set that has duplicate ID's and variable data (attached example).

I would like to calculate the total tonnes by month and the average grade of those tonnes. Using the 'month ID table' as a reference to the 'Raw Data table'.

Is this possible using if and vlookup functions or will require a higher level of programming knowledge?

View Replies!   View Related
Copy Data With Variable Row Lengths
I need to copy cells M6 to S6 down to all rows in a worksheet. The columns will remain M to S. The number of rows however vary in each worksheet.

How do I get the macro to read "End Down" with varying number of rows. I will need to do other functions also using "End Down" so if possible is there a generic code for this.

View Replies!   View Related
Automatic Data Based On A Variable
I would like to enter a vacation code in E5 (V12) and have it automatically enter "VACATION DAY (12 HRS * $15/HR) in K5 and calculate the amount in L5. Of course, there are variables involved here:

V indicates that it is a vacation day.

12 indicates the number of vacation hours to be taken.

The $15/hr comes from the value in I5.

I don't know if this should be handled as a VLOOKUP along with other methods or if this is something that needs to be handled in VB?

View Replies!   View Related
Linking Data When One Variable Changes In Src Worksheet
I'm using MS Excel 2003 Pro. I need to link data from one source worksheet to a target worksheet in the same workbook when only one variable changes in the source worksheet e.g.:

A. From source worksheet:

When the data under the "Expected Date" column is set (it normally is blank)

B. Populate target worksheet with:

1. Name
6. expected date (the actual date that is set from the source worksheet)

View Replies!   View Related
VBA To Find Variable Data Or VLOOKUP
I have a large amount of data Range A1:DA6000 on Sheet2 in the following format:

120200 1885 | 42.43 | 130112 1992 | 49.65

120200 1886 | 45.95 | 130112 1993 | 48.08

120200 1887 | 47.65 | 130112 1994 | 49.77

120200 1888 | 45.97 |

120200 1889 | 48.34 | 130133 1887 | x

120200 1890 | 49.42 | 130133 1888 | 41.6

120200 1891 | 48.85 | 130133 1889 | 45.45[/list]

Cell A1 Sheet1 will be variable and I need to find the same value on Sheet2 in all that data and copy the number in the cell to the right to the clipboard. For example:

If Sheet1 A1 = 120200 1885 I want to find 120200 1885 on Sheet2 and copy 42.43 to the clipboard

Or if it's 130133 1887 I want "x" copied to the clipboard and so on.

I think I want to have a macro "Find" the cell and copy the one next to it, but I don't know the syntax to do that. The macro recorder only takes me part way.

I can't figure out how to make a VLOOKUP formula work, as there's way more than 65,000 lines to make a lookup table out of the data.

View Replies!   View Related
Counting Different Cells With Variable Data
how to sum 3 cells when 2 out of 3 cells match.

Here is the data.

Cells A1:A10 = Florida
Cells A11:A20 = Florida State
Cells A21:A30 = ~Florida
Cells b1:b5 = W
Cells b6:b25 = L
Cells b26:b30 = W

Sum all cells that have "Florida", "~Florida" and "W" in common.

View Replies!   View Related
Data Sort For Variable Range
I have a recorded macro to sort Data with 3 sort fields but has a Fixed range. The Data will increase each week so I need to modify to account for growth.

View Replies!   View Related
Assign Variable To Different Data Types
Putting the final touches on a project I have and the last element doesn't work 100%. the scenario: I have a function that I wrote based on the user's input of the desired column to perform the operation. As a method of error-trapping and ease of use, I set instructions for the code to activate:

1) if the user highlights multiple cells of the desired column
2) enters the letter of the column (up to "z", not case sensitive)
3) enters the number of the column

Sub Button5_Click()
Dim ColumnUsed As Variant
' find number of columns selected
For MyColNum = 1 To Selection.Columns.Count
Cols = Cols + 1
Next MyColNum
'find number of rows selected
For MyRowNum = 1 To Selection.Rows.Count
Rows = Rows + 1
Next MyRowNum..............................

View Replies!   View Related
Set Variable: Object Variable Or With Block Variable Not Set
I have the following code (just pasting the relevant section) which crashes when it reaches the highlighted line of code. and a dialog box pops up with the text: "Object variable or With block variable not set"

Sub test()
Dim StartRng As Range
Dim Buffer As Range

Set StartRng = WorkSheets("Sheet1"),Cells(1,1)

ActiveCell. CurrentRegion.Select

Buffer = rngStart.CurrentRegion.Copy

' I also tried the following line of code but that didn't work either
'Set Buffer = rngStart.CurrentRegion.Copy
End Sub

View Replies!   View Related
Select Variable Data Range For Graph
I need to select data from columns A, B and I for the graph. I have the below code but get an error message. Can anybody help ?

Set cellGR1 = Cells(2, 1)
Set cellGR2 = Cells(K, 2)
Set cellGR3 = Cells(2, 10)
Set cellGR4 = Cells(K, 10)

Charts.Add ....

View Replies!   View Related
Defining Variable Data Row For Chart Series
I want the below code to run from R1C10 (i.e. cell J1) to the end of the data in the row, which will vary in position, rather than having to define where the end of the row will be beforehand (i.e. R1C21).

Is this possible?

View Replies!   View Related
Concatenate And Format Variable Amout Of Data
I have two sheets of data, exported by a program. The first sheet uses a single row for information of each log entry. The second page will have 1 to X rows for information of each log.

What I am would like to do is combine that data into one cell, and place it in the corresponding row on the first page. This will be used in a mail merge, and I would need commas and an "and" between the data points, where appropriate for proper English. I know how to get the data together, but am having issues trying to get the correct grammar within the cell.

Willing to use either VBA or other formulas.

View Replies!   View Related
Plug In A Variable Rather Than Read It From The Data Sheet
I am trying to limit the amount of stuff I write to a sheet, and I figured I can just pass variables around inside of a routine with out having to write each step to a sheet like I am doing now.

Below is the formula showing Z2 as where parsed data is

CVersionFormula = Evaluate("Z2 * 10 ^ (4 - Int(Log(Z2)))")

and here it is, with me trying to plug in a variable rather than read it from the data sheet. The variables for ease are read from the data sheet. In this example I would read in Z1 and assign it "CVersion", then the formula then takes CVersion (a 4 digit number) and makes it a 5 digit number..

CurrVersionE = Evaluate("CVersion * 10 ^ (4 - Int(Log(CVersion)))")

But I don't think I have the variables in there right.

View Replies!   View Related
How To Write A UDF That Returns Variable Length Of Data
If you have used Excel to download data from Bloomberg, you probably noticed that the function "BDH" can return an array of variable length. I was trying to design such a function but could not find a way.

The basic feature of a function like this is that it can be entered like an ordinary formula (not an array formula), but it returns multiple values. The values will be displayed in the range that has the formula as its top left corner.

View Replies!   View Related
Summing Variable Data Across Rigid Boundaries
I shall use a basic example to illustrate my problem - see attached - as the spreadsheet im actually working on is huge and contains sensitive data. So, In the spreadsheet attached, the problem is: I am mowing the grass of a football pitch and getting paid by the m3 of grass i mow. however i'm getting paid more when i mow at greater distances - defined by certain 'reaches'. so i need to know how many m3 ive mowed in each reach. I make a note of where I start on the pitch and where i end, and also how much grass i mow.

so im looking for a solution that is intelligent enough to distinguish where Ive taken grass from and how much, given that i know where i started, where i finish and how much i take.

View Replies!   View Related
Macro To Get Avearage Of Variable Set Of Data Into Another Sheet
Not sure what i'm doing wrong but I have this bit of code to get an average of a set of data. then i'm planning to paste that avearage into another sheet. however I cant seem to get the variable to work. without the variable it works:

View Replies!   View Related
Variable Range For Chart Series Data
I have data which is imported from a txt file and always starts at the same row (R19) but is variable in length (end of data R??). I want to be able to select the chart xvalues (R19C10:R?C10) and values (R19C4:R?C4) based on the number of cells with data in them for a given column. In addition I believe I'm having troubles with sheet references, when the txt file is opened the sheet name is set to the file name, since I want to use this macro on many different files I need the sheet referencing code to account for this. Anyway here is the section of code which seems to be giving me trouble (the initial sections just create a new column of data which needs to be referenced as the xvalues) ...

View Replies!   View Related
Autofill Macro For Variable Cell Data
I'll do what I can to explain this mess I want to clear up...I have a series of excel reports I have to download and work thru daily and I need to see if there is a code to autofill down thru a column, based on multiple statements throughout the goes:

f1 msp
f2 msp
f3 blank **
f4 mct
f5 mct
f6 mct
f7 blank **
f8 cci
f9 blank **

Regardless of the actual f cell, I always will need to fill the Blank ** cell w/ the values from the previous cell....Hope this makes sense...& thanks in advance....

View Replies!   View Related
Variable Data Dependant On Number Entered

Cell 1 equals a number
Cell 2 is the number entered into cell one times(X) 35 up until the number 6 is entered. Any number above 6 is Times 50. So. 1-6 is times(X) 35 while 6+ is Times(X) 50.

I am. Here's another example:

A salesperson gets a commission of $35 for each widget sold up to the first 6 widgets. If he sells more than six widgets, he gets paid $35 for the first 6 and $50 for anthing over 6.

The sales person will enter the number of widgets sold into a cell and the formula should do the rest.

I have been stuck on this for months.

View Replies!   View Related
Using Manual Filename Variable To Import Data
referencing a variable during a data import. I have searched the forums here and the web for a couple weeks and attempted enclosing the variable in many different symbols.

Nothing I have tried works. I have also read chip pearsons guide but I was still not able to get it to work.

I am trying to provide a way for the user to input the filename and location in an input box and then use that variable to import the data. It is only one file that is needed.

The message box filename is only included to allow me to verify the text input.

Dim Filename As String

Sheets.Add. Name = "All Data"
Filename = InputBox("Enter Filename: ", "Enter Filename Location")

MsgBox Filename
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;Filename", Destination:=Range("A1"))
.Name = "SHOAlarmsJune2-9"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False

View Replies!   View Related
Inserting Variable Number Of Rows And Populating Data
Inserting Variable Number Of Rows and Populating Data

View Replies!   View Related
Macro To Extract Variable Info From Data Set And Calculate Corresponding Values
I have a small data set (ends up with 8 columns, up to 1000 rows), that gets imported sorted and formated via a macro linked to a button. I need to be able to look at one particular column of info, which will contain different text values every time the data is updated, and create a list of all the different values that occur in that column (maybe 10 max). Then...... I need to calculate a numerical value from adjascent column, linked to the text values from the first process. Below is an example to better explain:............

View Replies!   View Related
Spreadsheet That I Have Variable Data In And I Want To Transfer Specific Parts Of The Workbook Into A Word Doc
I have a spreadsheet that I have variable data in and I want to transfer specific parts of the workbook into a Word doc.

Not a problem with the Excel part, I can select each and every cell that I want, copy them and then...

Recording a macro hasn't done the trick as the code I have only copies and doesn't paste. I know I can edit the code to open Word but the problem is that when in Word, the data needs to go to very specific places, some of it goes in the header, most goes in the main body, I can't see how this could be done as there are no cell refs as in Excel!

is it possible to paste to say halfway in a sentence, in a macro?

View Replies!   View Related
Calculate A Multi-variable Equation Based Off Of Data In A Table With Different Criteria
I'm trying to calculate a multi-variable equation based off of data in a table with different criteria. If you reference the attached spreadsheet I am trying to calculate cost based on weight and zone. For the data entered in cells B1 and B2 944.01 would be the cost. If you look at the table in G2:N3 you'll notice that the values in G2 and G3 are the weight limits G2 is from 0-4999 and G3 is 5000+, this should impact where the value in B1 falls. B2 should select from H1 to N1.

View Replies!   View Related
2007 Macro: Run-time Error 91:Object Variable Or With Block Variable Not Set
I'm fairly new to macro's and VBA, by searching on the internet i've copied and pasted some code together into a macro.
But it ends in a Run-time error 91...

The macro opens a target .xls file in a selected folder, performs copy - paste actions from masterfile to targetfile.
Than it filters data in the targetfile sheet1 and copy's the results to the various other sheets; saves and closes the targetfile.
The next target file in the folder is opened and the actions are repeated in this second target file.
For the first target file this works smoothly; but for the second one (of a total of around 100) it does not copy the filter results to the other sheets in this workbook.
The error message i get is: "Run-time error 91:Object variable or with block variable not set."
When i hit debug it highlights the line "ActiveSheet.Next.Select" which, at least in the first file, seems ok.

View Replies!   View Related
Insert A Variable Number Of Rows And Copy And Paste From And To Variable Positions
On the attached Excel file, I have code that will insert a variable number of rows and copy and paste from and to variable positions. That all works fine when run from a command button, but when I try to run it from the Worksheet_Calculate by entering 1 in J1 or K1 (inrange cell is J1+K1 for testing purposes) the CommandButton1_Click sub runs continously until an error occurs.

View Replies!   View Related
Macro Error Message (object Variable Or With Block Variable Not Set)
When i try to run the code below i get the error message - object variable or with block variable not set-


Cells(Sheets("POINTS").Range("DD801").Value, Sheets("POINTS").Range("DD800").Value).Select
Selection.AutoFilter Field:=1, Criteria1:="1"
Dim sFormula1 As String
Dim sFormula2 As String
Dim sCell1 As String
Dim sCell2 As String
Dim sSheet1 As String
Dim sSheet2 As String
Dim r As Range
Dim MyRange As Range 'for testing

With Sheets("Points")
sFormula1 = .Range("CY1").Formula
sFormula2 = .Range("CY2").Formula
End With

strFormula = "=IF(ISNA(VLOOKUP(RC[-1],MASTER!R4C3:R17908C7,3,FALSE)),0,VLOOKUP(RC[-1],MASTER!R4C3:R17908C7,3,FALSE))"
r.FormulaR1C1 = strFormula
Dim ar As Range 'an area is a range
For Each ar In r.Areas 'areas are discrete, contiguous ranges of cells
ar.Value = ar.Value
Next ar

Cells(Sheets("POINTS").Range("DD801").Value, Sheets("POINTS").Range("DD800").Value).Select
Selection.AutoFilter Field:=1

End Sub

View Replies!   View Related
Find Dates Macro: Object Variable With Block Variable Not Set
I found this nice little bit of code for a date range search in column A but it will not work. Apparently i have not set a variable or something.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim startDate As String
Dim stopDate As String
Dim startRow As Integer
Dim stopRow As Integer
startDate = InputBox("Enter the Start Date: (dd/mm/yyyy)")
If startDate = "" Then End
stopDate = InputBox("Enter the Stop Date: (dd/mm/yyyy)")
If stopDate = "" Then End
startDate = Format(startDate, "dd/mm/yyyy")
stopDate = Format(stopDate, "dd/mm/yyyy")
startRow = Worksheets("sheet1").Columns("A").Find(startDate, _
LookIn:=xlValues, lookat:=xlWhole).Row
stopRow = Worksheets("sheet1").Columns("A").Find(stopDate, _
LookIn:=xlValues, lookat:=xlWhole).Row
Worksheets("Sheet1").Range("A" & startRow & ":A" & stopRow).Select

End Sub

View Replies!   View Related
Copyright © 2005-08, All rights reserved