Creating Matrix With Variable Size

Nov 19, 2012

I am trying to create a matrix in VBA with variable matrix size. The matrix I need will be anywhere from 3 to 9 columns and 15 to 30 rows. I want to set the size as variables and then create the Matrix using these variables, similar to:

rows = 4
columns = 25
Dim XMatrix(rows, columns) As Variant

View 1 Replies


ADVERTISEMENT

Creating Adjacent Matrix From Incidence Matrix

Aug 26, 2007

I have a data chart on 200 people with overlapping membership in 20+ groups, represeted as binary (1=member, 0=notmember), for example: ...

View 9 Replies View Related

Taking Selected Area And Checking Matrix Size?

Feb 20, 2014

So far I have this just for testing but I do not know what I would do to have the user select a region and for me to test if it is a valid size for a matrix. (2x2 or 3x3 are the valid sizes).

Code:
Public Function MyInverse() As Variant
Sub Size()

Dim row As Double
Dim col As Double

[Code] ...........

Else:
MsgBox "You have entered an invalid size of the matrix. Please enter a 2x2 or 3x3 matrix."
End If
End Sub

View 2 Replies View Related

Creating A Scenario Matrix

Mar 9, 2007

Creating a Scenario Matrix. I am using Excel XP. Simplifying the problem, I have a formula;

Cell A1 has X,
Cell A2 has Y
Cell A3 has Z

X * Y = Z

I want to find the answers when X is between “1” and “5” and Y is between “1” and “5”. I want this to be in a matrix so I want the answers:

1 2 3 4 5
1
2
3
4
5

I cannot use Scenario Manager; it would record the answers on the pivot table or summary which is what I want BUT I would have to type every combination (1,1), (1,2) etc!

View 7 Replies View Related

Creating And Using Port Distance Matrix?

Jul 28, 2014

I have 1551 rows of port distances, as shown below.

From To Distance
Abu Al BukhooshDalian 6097
Abu Dhabi Jamnagar929
Ain Sukhna Gibraltar2026
Akpo Field Inchon9755

I have a list of 206 ports. I want to build a matrix of Port distances with the names of the ports (206 names) on the first row and column and the distance from each port to every other port. I understand that the 1551 rows of data that I have is not sufficient, but those are he only significant ones. For the missing records I would like to put "zero" in the matrix.

Also, Once the matrix is built, how can I use it to find the port pair distance when the user inputs two port (From port and To port)?

View 4 Replies View Related

Counting Formulas And Creating A Matrix

Feb 16, 2009

I have the following used formula to count how many occurances there are of a particular piece of text in a column:

=SUM(IF(range="text",1,0))

e.g. {=SUM(IF(K6:K16="H",1,0))}

I have repeated this formula for an adjacent column

e.g. {=SUM(IF(L6:L16="M",1,0))}

I need to find a way of counting number of occurances in these two columns (K and L) when text "H" and "M" are present in the same row.

To further complicate matters (well for me anyway) the text "H" and "M" care chosen from a list of options in the K and L columns.

What i ultimatly want to do is create a matrix to compare how many times all possble occurances of the various options listed in both columns are present in the same row in the spreadsheet.

View 2 Replies View Related

Declare An Array With Variable Size

May 7, 2009

I need to create an array with a variable as it size For instance:

View 2 Replies View Related

Named Range Of Variable Size

Aug 23, 2007

I am attempting to create a rather complex macro to format periodic raw data being made available to me; this data centers around a main column. The column of interest in these raw data reports is of variable length; I wish to apply a name to this column in order to make it easier to perform calculations. I know how to write VBA code to select every cell in a column down to the point at which the column becomes empty space, regardless of how much data is in the column, and I wish a include naming of the range in the macro. However, all my resources imply you must give the exact definitions of the range when writing the name application in VBA. Does anyone know if there is a way to include naming of a range in a macro without knowing the range's exact size? Put another way, is there any way to apply a name to an already-selected group of cells without giving the exact dimensions?

View 2 Replies View Related

Formula With Variable Range Size

Nov 27, 2007

It is useful to use lookup function to find the student name. However, if the table array size is variable

(say, a new student enrolled and the table array will be $A$2:$B$7), the table array size will be changed

and we need to change the vlookup function. How to avoid it? Can we use some kind of variable for the

See attached file( book1)

View 9 Replies View Related

Display Array In Variable Size Userform

Jan 23, 2008

I am trying to figure out how to make a userform to display the contents of a 2-D array which has a variable number of rows. I want the userform to height of the userform to correspond with the number of rows of data to display.

I don't have much experience with userforms, but here's what I was thinking:
VBA code which would find the # of rows of data and then adjust the height of the userform and the length of the lable (which the data would go in).

View 4 Replies View Related

Adding A Constant To Sets Of Rows Of Variable Size

Jul 30, 2009

I have data from 100 trials. Each trial has a variable number of data points (rows), but each row is labeled in the first column with the trial number. I would like a macro to identify the first row of each trial, calculate the difference of the value of the cell in column G of that row from a constant (718), and then add that difference to that cell and all other cells in that column of that trial.

So based on the attached sample, I would like all values in column G for trial 2 to be +1, for trial 3 to be -5, and for trial 4 to be +2.

In the file, I've cleared all the data from the impertinent columns. Eventually, I will also want to perform a similar process on column H but with a different constant.

View 2 Replies View Related

Indirect Referral To Variable Size Named Ranges

Feb 13, 2007

I am trying to use a combination of dependent named ranges and variable length ranges, so one can select in eg Col A truck name from a drop down list, and then in Col B, the engine variant only for that make of truck. The indirect(substitute) function works well if I define the dependent range name (the engine variant) using actual cell refs. However if I use the variable length name definition as described in Ozgrid (ie with offset function), I get an error message and the dropdown menu freezes. Is there anyway to overcome this without resorting to VBA?

View 4 Replies View Related

Find Variable Size Number Within Text String

Sep 20, 2007

I have a spreadsheet with a couple of hundred rows on each tab that looks like this: A1: #1 PENROSE TIJUANA MAMA PCH 2620039190 665794 12.00 CT 1 Front 1 1 1. The only constant is the 10 digit number followed by the 6 digit number in the middle and I want to use it to parse the text string. I want the output to be everything prior to the 10 digit number in A1, the 10 digit number in B1, the 6 digit number in c1 and everything else in D1 and so on through the rows.

View 4 Replies View Related

Return Inverse Matrix Of Large Matrix

Aug 22, 2008

Using VBA, I wish to work out the inverse matrix of a large matrix (100*100), but keep getting the # Num! Error. I am using the minverse function. I have defined variable as "variant", does this give me the same possiblities in terms of number size as the variable "Double"?

View 9 Replies View Related

Creating A Variable Word Art

Jan 23, 2009

I am wondering if anyone as created a what to do word art, using a input variable.I.e in may example I have a person, Suzie Smith who is an Chief Manager, when I box requires her signature, I would like for it eo be imprinted going diagonal across the box. Is this possible?

View 7 Replies View Related

Creating A Formula With A Variable

Jul 14, 2008

Column A will be completely empty.

When an * is inserted into a single cell in column A, that Row number will become the variable in this equation:

=Sheet1!$G$'variable'

i.e. if i put a * in A14, then the formula should read (=Sheet1!$G$14).

View 10 Replies View Related

Creating Variable Range?

May 18, 2013

How would I create a variable range with:

Sheets("output").Cells(I + r, 1):Sheets("output").Cells(I + r, 9)

View 3 Replies View Related

Creating A Variable Macro

May 24, 2007

I currently have the below macro:
If Cells(1, 3) = 2 Then
For a = 1 To 336
b = Round(a * 2 + 0.99)
Cells(b + 0, 3) = a
Cells(b + 1, 3) = a

Next a
MsgBox " Cell C1 is not equal to 2"
End If

where the intent is that whatever cell A1 is equal to, that is how many times over it will duplicate a number in consecutive cells before moving to the next number, ie:
1
1
2
2
3
3
etc to 336.

How can I tweak the code so that if I change the data in cell A1 to 9, I don't have to go in and change the macro?

View 9 Replies View Related

Creating External Reference With Variable?

Feb 27, 2014

I'm wondering if there's any way to put a variable for a cell address in an external reference formula. Basically, I'm creating an abridged report of customer data that takes a single customer's info from 2 other workbooks on a networked drive and compiles the chosen cell data into one worksheet summary of their info. The base external reference formula looks like this:

='F:Projects[CustomerDB.xls]Sheet1'!VariableCellGoesHere

I want to know if there's a way I can make the formula use a variable cell address that I can just type into another cell to tell it which row I need to grab info from. Generally, all of the customer data I need is spanned across multiple columns in one single row. The formula above appears multiple times in the sheet I'm trying to make. The first is for "Name", the next is for "Address", next is "Phone Number", etc. So for instance, if I want customer data from the main spreadsheet and that customer's info is on row 355, my first few formulas are:

='F:Projects[ProjectDB.xls]Sheet1'!$A$355
='F:Projects[ProjectDB.xls]Sheet1'!$B$355
='F:Projects[ProjectDB.xls]Sheet1'!$C$355

Is there a way I can maybe have a designated cell where I just enter the row number I need (e.g. 481) so the formula sees that number and plugs it into the cell reference above resulting in the formulas adjusting themselves to ='F:Projects[ProjectDB.xls]Sheet1'!$A$481?

View 9 Replies View Related

Creating String Using Variable File Name?

Dec 18, 2012

I'm trying to check to see if a file exists using VBA but the routines I see use a string that has the path and then the file name. I have a fixed path C:VBtesting and the a variable file name. I'm using a file name that consists of a username & date such as cwilliams201212. I'm having problems getting the variable file name into the string.

View 1 Replies View Related

Variable File Name For Creating External Links

Apr 10, 2013

I am working on a research project of which details cannot be disclosed. I basically have many worksheets which each contain 3D positional data and I am plotting overlaid graphs using multiple worksheets. I have gotten them to work where I manually enter the names of the worksheets, but I am trying to use the CELL("filename") command to get the current worksheet's name, then using a substitute command to change certain fields, then I would like to use the string name created by those functions to call a global variable in another worksheet which defines a range. I will try to give an example.

Say I have 3 worksheets for arbitrary measurements:
1) filename 1mm
2) filename 2mm
3) filename 3mm

I would like to graph all 3 sets of data in worksheet "filename 1mm", using the fact that everything in the filenames are the same except for the 1/2/3mm part. I have a template of which I will be copy/pasting data from numerous data sets and then each worksheet has defined names "X_vals" and "Y_vals" which give me dynamic ranges for the data I wish to plot from that worksheet.

When I type the names manually--i.e. " 'filename 2mm'!X_vals" everything works fine, but when I try to create the exact same string dynamically using indirect/substitute/left/right etc, it does not let me do it. I am able to create a dynamic string with a range, such as " 'filename 2mm'!C10:C100" but then when I change it to " 'filename 2mm!X_vals" it just gives me #REF!.

I guess my question is just is there any way to use the indirect function to create a string name dynamically which references a defined name in another worksheet? If not possible with just simple excel functions, is there a way to do this with a macro? I am not exactly familiar with VBA in excel, though I know how to run macros.

View 3 Replies View Related

Creating Range Object Using Variable Indices

Mar 28, 2008

how do we do something like Range("A1:B2") using an index for the cells. For example Range(R[0]C[0]:R[i]C[j]) which doesn't work. I know about Cells(i,j), but that only returns a range object of a single cell.

View 9 Replies View Related

Center Image In The Middle Of Cell Where Cell Size Is Variable

Apr 12, 2013

The idea is to center an image in the middle of a cell where the cell's size is variable. This shall be done for a column of images if a certain cell in the same row contains content different from 0. If not the image shall be invisible.

Sub Center()Dim Position As Integer
Dim Picture As Integer
Picture = 6
For Position = 7 To 320If Sheets("List of Measures").Cells(Position, 2).Value

[Code] ......

Run-time error 1004: Application-defined or object-defined error?

View 7 Replies View Related

Creating A User Form With Variable Number Of Controls Buttons

Sep 4, 2008

Is it at all possible to create a User Form where the number of CheckBoxes will be linked to the number of entries in a cell range?

For example I have a 3 records in the range A:A called "Blue", "Green", "Yellow". I want to have a user form with 3 CheckBoxes with the same caption names.

View 9 Replies View Related

Creating Autofilter That Returns Records Based On Date Variable

Mar 13, 2013

I have a strange problem I cannot solve in that I'm trying to create an auto filter that returns records based on a date variable.

If I set the code to equal the date variable, it returns information. If I set the code to return records AFTER the date, it returns nothing.

Code to return records on the date:

Dim startdate As Date
startdate = Format((Now), "dd/mm/yyyy")
ActiveSheet.Range("A:B").AutoFilter Field:=2, Criteria1:="=" & startdate

This returns data, however if I slightly amend it to get records on or after the date:

Code:
Dim startdate As Date
startdate = Format((Now), "dd/mm/yyyy")
ActiveSheet.Range("A:B").AutoFilter Field:=2, Criteria1:=">=" & startdate

It returns nothing. Is there a syntax problem in my code.

View 1 Replies View Related

Matrix - Identify Cell Content In Column For Row If Matrix Content True?

Mar 21, 2014

For a table like the one below produced for the sake of example (actual is much much bigger) I want to make it list rows that are true for a certain column for a certain variable in the matrix. So for say water terrain, which types of activity can I do i.e. swimming. Or for Offroad the activites which I can't do i.e. Run and Swim.

ActivityWaterRoadOffroad
Jog nym
Run nyn
Walk nyy
Swim ynn
y=yes
n=no
m=maybe

View 10 Replies View Related

Create Matrix From A Matrix

Apr 29, 2013

Below there are all the information needed to understand my problem.

M(1 to R,1 to C): matrix with R rows and C columns [element known]

M(i,j): elements of the matrix M in position i(row)-j(column) [element known]n

View 3 Replies View Related

Set Variable: Object Variable Or With Block Variable Not Set

Jun 4, 2007

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)

StartRng.Activate
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 9 Replies View Related

How To Get Value From Matrix

Jan 26, 2013

I need to get the fee value, if I write "Name" and "Time".

Please read the simple example file named "Fee from matrix".

View 3 Replies View Related

Sum Matrix

Jun 15, 2009

Given one array variable (matrix n x n) M, I want to use the function sum, to sum along the rows.

I can use Application.WorksheeFunction.Sum(M)

but this will sum all the elements

and I would like smtg like this
Application.WorksheeFunction.Sum(M(1,)

Just sum the first line, or the i-th line.

View 9 Replies View Related







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