I have a list of numbers in Column A and in Column B I have a standard Sum formula which sums the adjacent number in Column A and the four numbers before it.
I would like to have a formula which references another cell to define how many rows to sum from the starting cell. So in the above example, the total number of rows which are added together is 5. If I wanted to change all of the SUM formulas to add 6 rows, I would like to be able to change the number in the reference cell to 6 and all of the sum formulas would switch to adding 6 rows.
In the attached sheet. Cell C6 represents the concatenation of aspects of a product. I want to know if it is possible to use that cell as the named range (there is a corresponding named range) in a lookup. The lookup gives me the product code.
I'd like to be able to refer to a cell or local scope defined name within my sheet that references another sheet, or accomplish the same functionality in some way.
For example, if I have a sheet MyInformation and then another sheet MyPrintedInformation, where the printed information sheet shows MyInformation in a more printer-friendly format, I might have this in MyPrintedInformation:
a cell or defined name that says (this doesn't work, but just as an example): let's call the named variable TheSheetToPrint ='MyInformation'. Then from within MyPrintedInformation all of my references look like this
referencing constant cells in custom functions. This is a sample of my code:
Code: Select Case Name Case Is = "Ball" Valve_Days = [V4] + Cushion Case Is = "Check" Valve_Days = [V5] + Cushion
Now, the problem is when I open the workbook up, or someone downloads the file from the server, it resets all fields to div/0 based on what sheet the last user 'Saved' the document on. I think this is occurring because it doesn't know which sheet to pull the value V5 from? The problem never started to happen until I added another sheet in the workbook. Is there a way to tell VB that it isn't just cell V5, but it is cell V5 on Sheet 'X'?
I am having some trouble with a variable range selection within a regression. I keep getting an "application-defined or object-defined error." I've isolated each statement to find that the code that is causing the regression not to work is below (the error for that line of code states that the Select method of Range class failed):
In several places in my code I need to define ranges and save them in Application.Names. I need to be able to reference the last row and column in that range but I don't know how. Is there a reference within the Range object for the boundaries used to create it?
ie, the B3 in Range("A1:B3")
Not all of the ranges will have content in them and many of them will overlap, so looking for the last non-blank cell won't work.
How to assign a range in excel using a defined (different) cell.
I've this formula =INDEX($A$1:$A$17,RANK(B2,$B$1:$B$17))
I want to to choose the range from A1:A17 ... i'll use the formula too many times with different ranges for example A1:A21 and i want to know a way to insteed to change it manually each time to make the formula consider the value i insert in a different cell, so i can only change the value in this cell.
=INDEX($A$1:$A$D1,RANK(B2,$B$1:$B$D1)) so it can consider the value in cell D1
The goal of that formula was to return a Date/Time stamp that is fixed and doesn't change over time. The formula is intended to run in which ever cell that I select to enter it into. I named the formula:
What I am trying to do is create a macro that will run the formula using a hot key function. I want to be able to select a cell and hit CTRL D and have that above formula run in that cell. I have multiple sheets in my workbook and I need the macro to be able to run on any sheet in my workbook. Below is what I have:
Sub DateStamp() ' ' DateStamp Macro
I was trying to apply the macro to only a certain range of cells on any given sheet.
is a Defined Name which refers to a column on another tab in the workbook, and is defined as:
What I would like to do is to come up with an approach to this formula that would allow me to drag it across columns and have the year automatically increment (e.g., FY2013_TY, FY2014_TY, all of which are similarly defined Defined Names referring to adjacent columns). I have tried various approaches using INDIRECT along with CONCATENATE, but when it comes down to evaluating the formula, I consistently get a #REF! error.
I have a very strange problem in DEBUG mode, because i get this error "Application-defined or object-defined error" when referring to a cell and assigning it a value so it goes to my error handler and i have a Resume Next there. It continues to go through the code whilst continuing to go to the error handler but when i step out of the function it restarts again from the beginning on the called function and then on the second run of my code it seems to WORK!?! So i'm thinking what the hell is going on, it falls over and fails the first time round and works the second time round? In free-run mode from excel i just get a #VALUE!
I am looking to run two separate macros. I have a project plan and I am looking to be able to select a button whereby on-click, a new row is created within a selected cell. However if the cell clicked is outside of a pre-determined range, then the task is automatically entered at the bottom of the plan. I would like for the copied row to go ABOVE the selected cell and have all of the same formatting as the row below (not the top - as is default in Excel).
The second is going to be very similar but will copy a task category (like a header item) and the first task (row) found below. It will also be copied from below and be inserted above the selected cell.Both macros will clear certain cells, whilst maintaining the contents of others, with formula contained. I.E. Columns C,D,E,H,I,J will be cleared.
I have several SumIf formulas that references a Cell in a Main Reference Tab. This is useful to me as I have over 100 tabs of data points and having a reference cell with that text is easier to change one time vs 100 times.
My question is this: Will Defined Names be "faster" than using a reference cell? With over 100 tabs, there's a lot of formulas and I'm looking for a faster way to get the same output without Excel Memory overload.
So I have 2 sheets from a much larger worksheet where I wish for the first sheet to extract a row of values, one at a time from the second sheet using a range of numbers I enter as reference for where to look for the data. Sheet 1 can be thought of as a summary page and Sheet 2 is where data is stored.
I need to first check if any data under Sheet 2 column B fall within a specified range of numbers and if any of those numbers are found I want it to grab the largest and latest number from that range and pull all the data from certain columns in that same row and place it into Sheet 1, one column value at a time.
Sheet 1 A1 = A range of numbers as text. 10-15, 16-20 etc Only one range is entered. This also tells me what results I'm looking at. Sheet 1 B4:B14 = Destination cells for the individual data I'm wanting to pull from Sheet 2 columns H:P. B4 wants H, B5 wants I, B6 wants J etc
Sheet 2 column A = A3:A102 are numbered 1:100. Sheet 2 column B = A series of numbers anywhere from 10-70. Always in sequence and they can repeat. 10,10,11,12,13,14,15,15,15,16 etc. Ranges from B3:B102. Only one number per cell. Sheet 2 columns H:P = Data in H3:P102 I want to extract to Sheet 1 B4:B14.
Now lets say I want a formula for Sheet 1 B4 which wants a value in Sheet 2 H. If Sheet 1 A1 = 10-15, I want to check whether Sheet 2 column B has any values equaling those and then tell me which row that last number appeared in. Example: Sheet 2 B4=14, Sheet 2 B5=14, Sheet 2 B6=16. Use B5. (B6 is outside range and B4 isn't the last time the 14 appears.)
Then, knowing B5 is the value I want, find which row it is in (row 5 in this example) or use the number in A5 (3) and then find my way to column H (H5) where the value I want to pull is.
Example 2: Sheet 2 B4=14, Sheet 2 B5=14, Sheet 2 B6=16. Use B5. Sheet 2 H4=10, Sheet 2 H5=32, Sheet 2 H6=42. Place "32" from H5 into Sheet 1 B4.
I'd like to also have some error control so I'm not trying to pull data from blank cells if it's relevant. Maybe check if Sheet 2 X3=0 and if it is, do nothing as no data appears if the cell is 0.
I have put a lot of time into trying to solve this myself but I feel way out of my depth. I've tried going step by step but I can't seem to figure out which functions are relevant and also things like how to return the range that the A1 values appear in or if using MAX, not having it return values outside of A1's range also.
I have a workbook with two sheets. The first sheet is the data sheet.
Data Worksheet A B C D colA colA,B colA,B,C colA,B,C,D 104 20 21 CR10600S 104 10420 1042021 1042021DUS 104 20 21 CR10600SX 104 10420 1042021 1042021DUS 104 20 21 CR10603S 104 10420 1042021 1042021DUS 104 20 21 CR10603SX 104 10420 1042021 1042021DUS 104 20 22 CR49605S 104 10420 1042022 1042022HKZ 104 20 22 CR49605SX 104 10420 1042022 1042022HKZ 104 20 23 CR39601P 104 10420 1042023 1042023SPR The next sheet is where the magic happens. Separate this worksheet into two sections. The reference section (column A and B) and the entry section (column E-G). Column D is a formula that will concatenate column E-G together. In the entry section any number of combinations can be entered. In the reference section I need to take the style number and reference it back to the data sheet. Then take the possible combinations from that style (column E and greater) and see if any of those combinations exist on the other sheet in column D. If so then say added....otherwise say needed.
"....In Pricing Sheet" is where I am looking to put needed or added or something like it. A B C D E F G STYLE …IN PRICING SHEET Concat DEPT MCL SCL STYLE CR10600S Added 1042021 104 20 21 CR10600SX Added 1042022 104 20 22 CR10603S Added CR10603SX Added CR49605S Added CR49605SX Added CR39601P Needed Any ideas on how to do this in formulas and without code? I have tried and looked into index, match, dget and lookup. I just don't think I am finding the right combination of formulas.
i need to copy a range from one workbook ("weekly data") to another ("Yearly data"). The range to copy is called 'weekly data'. The ranges to paste to are called 'week 1' through to 'week 52' (this is the yearly data sheet). On the yearly sheet there is a cell Po1' that week on week will state the week number ie 'week13', 'week14' etc. code to use this data in 'P1' to tell the macro to copy to the appropriate week. I have attached as far as i got (then failed due to lack of experiance).
presuming that both books are open
HTML windows("weekly data").activate sheets("weekly transfer").select range("weekly data").copy windows("yearly data").activate 'only one sheet in workbook range ' data from p1 .paste
I have a variable which contains the column number. How do I then reference a range in VBA using that column number, as opposed to the letter? I know how to convert the number into the letter, but I also know there has to be something more simpler. For instance, a form of the ADDRESS function, but in VBA?
I have a loop that executes roughly 7.7 million times when my VBA program runs. Neednless to say it take a long time to run - usually a couple days.
The inner-most loop contains a line of code from way back in my early vba programming days when I knew even less than the small amount I know about programming now (and if you can follow that sentence you might be able to understand some of the spaghetti code I write :-) ).
for k = 1 to n
if Worksheets("Personell").Range("D" & Trim(Str(k))) > dtCompleted then ...
Would it be faster to use this syntax (which I just found out about):
if Worksheets("Personell").Cells(k,4) > dtCompleted then ...
It would cut out 2 functions calls, trim() and str(), so it would be faster, right?
I am almost embarassed to post the Range("D" & Trim(Str(k)) line of code because it looks so convoluted now, but that's how I learned to program, just fumbling through until it ran...
So in short, I just wanted to confirm that the cells() syntax run faster before I spend an hour editing and tested.
I am writing a function that opens up an external excel document, identifies a string in a certain range and then i also want it to return a cell reference for that string including the number of rows beneath the cell that the string was found in.
I'm working with a very complex financial workbook with over 3,000 named ranges and would like code to replace the named ranges with the cell references and display it in a message box so the user can easily trace the references without removing the named ranges from the formula. There is a lot of code with the named ranges, so actually converting them to cell references is out of the question.
I found this code, but obviously it physically replaces the range names in the cell. Hopefully it can be converted to display it in a text box.
Code: Sub FixReferencesToCellNames() Dim c As Range, n As Name For Each c In Range("A1:IV65536").SpecialCells(xlCellTypeFormulas)
What I am looking for is that a user select a cell that they want to see the references, run the code to see the cell references for that particular cell in a message box.