Dynamically Change The End Value Of A Range In A Function
Jul 20, 2006
I am using the STDEV function on a range of values: STDEV($I$26:I2545). My starting cell is constant and I would like to make my ending cell variable based on a value I enter in a master cell (A1). The value I enter in the master cell is multiplied by 252 the product would equal the row number I would like to stop at. So if I enter 1 the formula will be STDEV($I$26:I252). I tried: STDEV($I$26"I"&(A1*252))) and other such variations to no avail
View 5 Replies
ADVERTISEMENT
Sep 24, 2006
I maintain Production data in an Excel Sheet and have the code which will create Chart for each Employee. Sample Sheet Attached. However, I want the Chart Range to be updated in a Single Chart and exported to a .Gif File.
View 2 Replies
View Related
Aug 10, 2007
Need assistance with this code provided by SHG. See attached sample. I need to create a range called DaysOff so that this function will work. As it is the function is perfect; though the accuracy if the result is dependent on the exact range, thus I need this named range to be dynamic. I have tried but it does not seem to work correctly. The named range should refer to the list of names between 1-10. The range should dynamically include any names that are listed.
Public DaysOff As Range
Function datNext(datLast As Date, DaysOff As Range) As Date
Dim datBeg As Date, datEnd As Date
Dim iLastPd As Integer
Dim iDay As Long, nDay As Long
Dim iYr As Integer, iMo As Integer
iYr = Year(datLast)
iMo = Month(datLast)
datBeg = DateSerial(iYr, iMo + 1, 1)
datEnd = DateSerial(iYr, iMo + 2, 0)
iLastPd = Pd(datLast)
nDay = DaysOff.Rows.Count
Do.......................................
View 2 Replies
View Related
Oct 26, 2009
I have the following vlookup formula in my spreadsheet.
IF(ISNA(VLOOKUP($A2,'Purchase Order Pivot Table'!$5:$500,67,FALSE)),0,VLOOKUP($A2,'Purchase Order Pivot Table'!$5:$500,67,FALSE))
It works perfectly for my current requirement, but it looks at data in a pivot table which is created from a dataset. If I name the columns in the pivot table so instead of looking at column 67 it looks at a name range will this name range change dynamically when the pivot table is refreshed? If not how can I get it to.
View 2 Replies
View Related
May 21, 2014
I have a link
='S:2014DomesticATL[ATL-BP Eval-2014-04.xls]Business Partner Evaluation'!F$13
Now i have to compile 3 years of data for 200 airports so changing the month and year for every airport would be a challenge. I can do Replace all and change the year and month but instead of that i was thinking if i could have the year and month on one row and connect the links to that cell so that whenever i drag the cell my link changes
im looking at
2014DomesticATL[ATL-BP Eval-",D2",.xls]Business Partner Evaluation'!F$13
where in D2 i will have 2014-04 . But this formula doesnt seem to work. Is there anyway i can do this ?
View 3 Replies
View Related
Jul 29, 2009
or it's text box/ labels depending upon learning of how many records the application is working with?
I remember some body here has said that you could either
1 - create many labels and text box and then once run the application hides the number of the ones not use or
2 - you could once run the application have visual basic create label and text of the right number associate with the number of records working with.
I have looked at both these option and have found nothing. So is this possible and show some examples if you have them.
View 9 Replies
View Related
Jan 2, 2012
I have used this code a number of times to automatically change the scale of x axes without problem. I have just used it however and it has condensed the data so that it the line only appears in the last quarter of the chart.
Code:
Option Explicit
Sub ChangeStaticAxisScales()
With Sheets("Static Charts").ChartObjects("Chart 2").Chart
' Value (Y) Axis
With .Axes(xlValue)
.MaximumScale = Worksheets("Raw Data").Range("AN7").Value
.MinimumScale = Worksheets("Raw Data").Range("AN6").Value
.MajorUnit = Worksheets("Raw Data").Range("AN8").Value
End With
End With
End Sub
View 3 Replies
View Related
Dec 23, 2013
Is it possible to dynamically change how values are displayed in charts?
I have a list which references different named ranges. It either needs to display the values in a graph as a number (without decimals) or a percentage depending on the source. Is this possible? Maybe with some VBA? Or am I asking too much from excel?
View 4 Replies
View Related
Oct 11, 2006
I've got an excel worksheet that contains charts 5-14, each with different max axes on primary and secondary scales. Right now the code below works to adjust the axes, however I have pasted this into a script 10 times, once for each chart with different references to the chart number, the max primary axis and max secondary axis. how I could write the following as a loop so that I don't need to have to repeat this routine in my code?
Sub ChartsBillingsShare()
ActiveSheet.ChartObjects("Chart 5").Activate
With ActiveChart
.HasAxis(xlValue, xlPrimary) = True
.HasAxis(xlValue, xlSecondary) = True
End With
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = 0
.MaximumScale = Range("Y6").Value
End With.................................
View 4 Replies
View Related
Jun 26, 2007
For a form that dynamically creates a series of text boxes and labels, does anyone know how to change the caption of a dynamically created label to display the value of a cell in a worksheet? The cell in the worksheet changes according to input on the text boxes. In the form's code, I have:
Dim newLblFreq As MSForms.Label
Set newLblFreq = Me.Controls.Add("Forms.Label.1", "lblfreq" & i, True)
newLblFreq.Caption = Range("V" & i).Text & " Hz"
But once the label is created, the caption won't change, even if Range("V" & i) changes...............
View 6 Replies
View Related
Apr 14, 2008
My Example
I have Master Book1 which has external links to Book2, Book3 and Book4.
My Formula in Cell B2 is ='D: empxl[Book2.xls]Sheet1'!$A$1
In Cells A1, A2 and A3 I have the text entries 2, 3 and 4 respectively.
Is it possible to use these Text entries to update the Formula I plan to copy down from B2 onwards?
i.e. Formula would read something like ='D: empxl[ Book"A1".xls]Sheet1'!$A$1
View 4 Replies
View Related
Aug 8, 2014
What I need to do is basically use one sheet from my workbook as a 'template' for all the other sheets, but in a way that when I make a change to a formula on my 'Template' sheet all the other sheets based off of it follow suit. I need to do this because for 100000's of rows, spread across different sheets, I have product information populating Columns A-G, and their unique cost in Column H. I need to apply markups to each product (row), but all of these markups are standard across every product and thus every sheet. So in the perfect world I would be able to edit the formula on Sheet #1, and then have that change be reflected in every other sheet.
So let's say I have something like this on Sheet #1...
[URL] .....
Where Column C is a product of A & B...ie. "=A2*B2"
What I need to happen is on Sheet #2 is for it to somehow pull the same formula that is on Sheet #1 in Column C, but apply that formula to 'A2' & 'B2' on sheet #2. And I also want it to update whenever I change the formula in Sheet #1.
If it requires that I set up a template on a completely different workbook, that is perfectly fine as Sheet #1, my 'Template' Sheet, does not hold in actual product information.
View 14 Replies
View Related
Jul 23, 2010
Is there a way to increase the size of the data table dynamically?
View 10 Replies
View Related
Apr 21, 2009
I have a Big Question about the SMALL Function in Excel. I would like to know if it is possible to use a syntax that will make the small function update my graph dynamically.
Personnel transfer out of the Department on know dates... but they come in to the Department all the time. I would like to know if I can increase the "range of my data" even if I don't have data in the cells (i.e. B2:B6 have data, I want the range to include B7:B16, which has no data)... When I have no data in the cells I get errors/ circular references...
Ideally, I would like be able to add or remove personnel and the SMALL function would "organize/update" my graph dynamically. Is this possible?
View 6 Replies
View Related
Aug 10, 2008
I have a named range that expands and contracts based upon the amount of data that is in some column. Call it AllData_UsedRange.
I have another named range that actually refers to a range. Call it AllData.
Column A
Row2 56
Row3 44
Row4 65
AllData is a named range that refers to the range A2:A65536
AllData_UsedRange refers to A2:A4 by way of this formula.
=OFFSET(AllData,0,0,COUNTA(AllData))
How to I obtain an address of AllData_UsedRange in VBA code?
These do not work...
ThisWorkbook.Names("AllData_UsedRange").RefersToRange.Address
Evaluate(ThisWorkbook.Names("AllData_UsedRange"))
View 9 Replies
View Related
Aug 14, 2007
I am have some code that takes values from a range (sourceAll) defined on my worksheet as:
Set sourceAll = Workbooks(pathnm).Worksheets(m).Range("A1", "S34")
I'd now like to be able for the range to be generated dynamicaly, but my problem is that the far right column (S) does not always have a value for every entry. Is there a way of using a column that does have a value for every entry, say column B, but then extending the range accross to S? If possible I'd like to avaoid having to move one of the columns with values for every entry. Auto Merged Post;I was looking at some of the suggested threads and found some code that I worked into my own
Set countRow = Workbooks(pathnm).Worksheets(m).Range("B1250").End(xlUp)
Set sourceAll = Workbooks(pathnm).Worksheets(m).Range("A1", countRow)
sourceAll = sourceAll.Resize(sourceAll.Rows.Count, sourceAll.Columns.Count + 17)
now this seems to work mostly, but it has deleted everything that was in column B.
View 2 Replies
View Related
Jun 27, 2012
I have a 'receipt' worksheet with about 500+ lines of data, here is an example of what could be in cell A166: 1.1 NET_AMOUNT 742,523,253.83
In another worksheet, is there a way to look at the whole worksheet for column A in receipt to say:
if 1.1 is true, capture text to the right of 'NET_AMOUNT' then format using =Dollar?
View 9 Replies
View Related
Feb 14, 2013
The way I have try to define lastcell is wrong. But I don't know how to do it.
Code:
Sub createUniqueRecordID_2()
'
' fill using CTRL + ENTER
'
Dim lastcell
Sheets("projects list").Select
[a1].Select
[Code]...
View 1 Replies
View Related
Jan 21, 2009
See the attached example. I have data listed as shown, but need the chart to automatically update whenever a new sales figure is added to the next month. I know you have to use the OFFSET to create dynamic ranges but I can't get it to work horizontally, only if my data is laid out vertically.
View 2 Replies
View Related
Apr 19, 2013
I have a challenge I'm trying to surmount. I have an excel sheet in which I want to be able to select Zone codes from a drop down, click on a link "search" which takes me to a place in the document that has been named according to the Zone code i pick in the drop-down. I want to achieve this using only formulas as i'm distributing the file to a wide audience who are not versed enough with computers to know how to enable macros.
View 3 Replies
View Related
Apr 1, 2008
I have 100s of name ranges in my spreadsheet. I am using a series of drop down boxes for the user to select the info that they want to see. Based on the dropdown box, the macro "dynamically generates" a range name from which to pull the info.
For instance, if they Select Manager = Terry, Analyst 1, and Month = Jan, then the range name would be JanTA1
The if statement would dynamically create this name by concatenating the info
If manager = Terry
mnger = "TA"
if analyst = 1
anlyst = 1
if month = Jan
mnth = "Jan"
rangename = mnth & mnger & anlyst
So, I am dynamically creating the range name based on user selections...then to display it, I want to set the display cell = to the value
Range("display cell").Value = Range(rangename).Value
The problem is, I am getting an object error every time I try to refer to a range this way.
If I type:
Range("display cell").Value = Range("JanTA1").Value, it works
View 9 Replies
View Related
Jan 1, 2010
I have a combobox whose list is filled with different ranges, on different sheets, selectable using option buttons. The code is shown below:
Private Sub OptionButton1_Click()
Dim ray
Dim Last
ray = Sheets("Trades").Range("B2:B500")
If OptionButton1 = True Then
With ComboBox1
.List = ray
.ListIndex = 0
End With
End If
End Sub
View 9 Replies
View Related
Aug 31, 2007
I'm trying to create a chart and set its source dynamically.
I've tried two methods, the first by setting the XValues of a chart's series collection to a range specified by cells,
ActiveChart.SeriesCollection(1).XValues = range(Cells(9, coloffset + 4), _
Cells(9 + numvsteps, coloffset + 4))
And by using the chart wizard.
Call vchart.Chart.ChartWizard( _
Sheets(resultssheet).range(Cells(9, coloffset + 6), Cells(9 + numvsteps, coloffset + 6)), _
xlLine, , xlColumns, _
Sheets(resultssheet).range(Cells(9, coloffset + 1), Cells(9 + numvsteps, coloffset + 1)), , _
False, "End-End Eff., " & current & "A", "Line Voltage", "Eff. [%]", "test")
Setting the XValues property gives an "Unable to set the XValues property of a series class".
Using the chart wizard, trying to set the category labels parameter of the chart wizard to a range doesn't give an error message, but does leave the category labels section of the chart (when I click and view it) blank.
I've also tried
resultssheet = "Sheet1"
tempstring = "='" & resultssheet & "'!" & "R9C" & (coloffset + 1) & ":R" & (9 + numvsteps) & "C" & (coloffset + 1)
ActiveChart.SeriesCollection(1).XValues = tempstring
When I step through the code, tempstring is "='LineReg Results'!R9C1:R19C1", which is correct, but I still get an "unable to set the xvalues property of a series class" error.
Interestingly, if I record a macro of me setting the category labels, and play it back, I also get the error.
View 7 Replies
View Related
Apr 20, 2009
I'm hoping this is a simple question someone might help clear up for me.
I've defined a few cell ranges on a worksheet (in my example I've defined their names as site1, site2, site3, site4, site5). All these ranges are identical in # of columns and rows.
On a separate worksheet, I'm trying to display a single named range, depending on the value in a dropdown menu.
In my example, I have a pulldown menu with the following items: site1, site2, site3, site4, site5 (mirroring the named cell ranges). I'd like to display one of these ranges, depending on which name is selected in the dropdown.
View 6 Replies
View Related
Feb 24, 2014
I wanted to enter value in sheet1 on A1. Columns in sheet2 from B1 until the value entered in sheet1.A1 should be automatically filled.
E.g.
Sheet1.A1=5, then Sheet2.B1=1, Sheet2.B2=2, Sheet2.B3=3, Sheet2.B4=4, Sheet2.B5=5.
if Sheet1.A1=3, then Sheet2.B1=1, Sheet2.B2=2, Sheet2.B3=3.
if Sheet1.A1=7, then Sheet2.B1=1, Sheet2.B2=2, Sheet2.B3=3, Sheet2.B4=4, Sheet2.B5=5, Sheet2.B5=6, Sheet2.B5=7
etc.
View 2 Replies
View Related
Jan 10, 2014
i have some existing code which is trigerred when anything is input into column c. The code then adds various information in another three columns. One of which pastes a vlookup formulae, and i would like this forumlae pasted into the column c cell which i initialy edited, in order to remove the requirement for one additional column.
The existing code i have is:
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim MyText As String
MyText = Environ("username")
If Target.Cells.Column = 3 Then
With Target
If .Value "" Then
.Offset(0, 2).Formula = "=VLOOKUP(D:D,'P:TAOffshoreTAOffshoreTreasuryRecsGeneralCommit ID''s for control Sheet - Do not move or delete[commit ids - DO NOT DELETE OR MOVE.xls]Sheet1'!$A$1:$B$65536,2,0)"
[code].....
I have tried changing the offset to (0,0) or changing the offset to 'target = ', which does add in the vlookup but then the macro debugs at the 'If .Value "" Then' code?
View 3 Replies
View Related
Jun 23, 2006
How would I add this formula as a worksheet function with VBA. I can't see INT, MOD or Year in VBA. Also want to change C2 to change to activecell column + row 2.
=INT(((C2-1461)- SUM(MOD( DATE(YEAR(C2-MOD(C2,7)+3),1,2)-1461,{1E+99,7})*{1,-1})+5)/7)
View 4 Replies
View Related
Aug 20, 2014
I need to read or clear all the line in specific range which will be increasing dynamically. Problem is "Selected File List" table range is not specified. New file chosen with browse will be added to "Selected File List" dynamically. Number of file can't be predicted.
vbaStk.JPG
What I've tried so far is, keep track of the browse button click and add the file path to arraylist. After that, (Row number 9 which is start line + arraylist size) to get the number of line of end of the table. But due to some requirement, I want to read the file from excel file. Something like -Read until found blank line or border bottom or something.
I'm new to VBA and I'm not so sure what I'm doing with vba codes
View 1 Replies
View Related
Apr 13, 2007
In Mr Excel's Pod Cast on April 12th, he showed how to use the OFFSET function to define a range inside a SUM function. Then he had Conditional Formatting that would highlight the range that was being summed. Can anyone tell me what the formula would be inside the Conditional Formatting dialog box to get the OFFSET range to have a certain format?
View 9 Replies
View Related
Jul 23, 2013
I have a function
VB:
Function f1(Matrix As Range)
'Does something and returns f1 = a double
End Function
And a second function which defines and constructs a matrix of doubles to use as an argument in f1 to return a double:
VB:
Function f2(dD As Double)
Dim MatrixRed() As Double
Redim MatrixRed(1 To dD, 1 To 10)
For i = 1 To dD
For j = 1 To 10
MatrixRed(i, j) = i * j
Next
Next
f2 = f1(MatrixRed)
End Function
I get an output error (#VALUE). I think it has something to do with MatrixRed not being a range anymore?
View 2 Replies
View Related