I am wanting to allow the user to select a cell in a worksheet and return the cell address and information/value from the cell. For example, if "Dog" is in cell A1 and "Cat" is cell A2 and the user initiates the Macro I would like the macro to to pop up a message box and say something like "Select a cell in Column A". When the user clicks on cell A1, I would like the message box to pop up and say, you selected "Dog" in cell A1.
Code: Dim selection As Range Dim minimum As Integer Sub Sequence() Set selection = Range(Cells(4, 3), Cells(6, 5)) minimum = Application.WorksheetFunction.Min(selection) ' and now I need an address of that smallest number for this: ' IF (column number + row number) > value of that smallest number ' do End Sub
It's not exactly the program I need, but it's simple.
does excel have a function or some kind of method where you can have it display the range of cells that you have selected? For example, if I highlight cells A5:G7 what would be the code for excel to display "A5:G7" in a message box? I need this to be dynamic, so the next time I select cells B3:T32, it needs to display "B3:T32."
The main worksheet is a roll up page of sorts. It contains all of the information on all three other tabs. All updates entered on the main sheet will be distributed accordingly to each sheet the needs it VIA hlookup. At times, certain updates will be highlighted certain colors. From what I understand, there is no way to copy the color formatting using formulas and return the value.
So, I am trying to figure out a way to use VBA for this. I have dabbled a bit in VBA have think I have found it, except I have run into a substantial road block.
I will use the .hasformula to first check all cells in a range on the other sheets. If there is a formula, it will be an Hlookup only. Once it finds the formula, it then needs to copy the color of the source cell the hlookup is using to return data. It needs to copy the color of the cell, not the color of the text.
I have a formula that basically work, except is really complicated and slows the whole sheet down and then, for some reason, returns a circular referencing error or something. There must be a better way!
So the back story is that I have a spreadsheet that I'm using to track ~1200 employees, including salary, job title and, where I'm having trouble, reporting line.
Column [R] is the Line Manager (direct manager) and Column [S] is Department Head. Columns [T] - [Y] is "Manager", "Manager +1" (manager's manager), "Manager +2" (manager's manager's Manager), etc up to Manager +5.
'Line Manager' is input manually. 'Manager' = 'Line Manager'. Manager+1 to +5 just vlooks up off the same sheet. This part works fine and will update the whole reporting line if you change the manager.
Department head is where I'm having a problem! Essentially what I'm looking for is for the formula to look at the 5 cells to the right (the manager +# columns) and look for 'Mr Boss' and return one cell to the left since department heads report the the boss. There is one exception, its that some immediate reports of Lucy Lawful also are counted as Department Heads. For this purpose I vlooked up this list of exceptions on another sheet. My formula is this (entered as an array):
I have a range of cells (C29:BB29) containing zeros and integers, I want to lookup the smallest non-zero value from that range in another range (C11:BB11) and return the cell address from C11:BB11 to use in a further SUM formula. Is that possible?
I'm trying to return the cell address of an lookup. The lookup result is correct, but when I try use the below Address function, it just returns the text value (i.e., the formula itself) instead of the cell address. Below is the an example of each: ...
how to get the value of a cell by its name. For example, i give cell B2 Name "Hello" and value "2". how to use vba to get the value of 2 using its name 'Hello', but not the cell 'B2'. Somethings people delete and add rows or columns and using range may lost the right value.
I want to be able to display the location of a specific cell no matter if I move it around by inserting cells above it. I've used =ADDRESS(41,2,1,TRUE,B41). Cell B41 contains the word "Tommy". So the result of this formula returns this: Tommy!$B$41. But now if I insert a row above cell B41, "Tommy" moves to cell B42 but the formula still returns: Tommy!$B$41. How can I get the formula to display the new cell address of "Tommy"?
I have two columns of numbers in column A & B. In column A I am trying to locate the maximum value and get the cell address of the number next to it in column B. I am currently using this formula to do this ..... =ADDRESS(MATCH(MAX(A1:A4),A1:A4),2,4)
It works ok, but if the maximum number is the first value in the column it is returning the last cell address in column B. I am not sure what I am doing wrong.
The format for the sheet is set in stone and can't change, and therefore my macro's operate on set columns / rows amd cells.
Because the sheet is huge, im trying to figure out a way to only run the macro's that need to run and more specfically on the changed location.
I need to create a routine that on the user changing a cell, it returns the cell position (row,column), then it will call a routine i have already which decides based on the cell location, which macro to run and where.
It's a spreadsheet of about 300 rows, each row corresponding to a certain department. each row is filled with various data, both text and numerical, including various different scores and averages. the columns include daily scores and weekly averages. I want to be able to create a new column that will calculate the time (in days or weeks) since the last score/average was entered.
1. a formula that will return the address of the last numerical entry in a given row. (I've got a MATCH formula that will do this, although it doesn't let me specify different cells or ranges, only the entire row)
2. whichever cell is returned will give the date instead of the value. (for example, if the last value entered is in $F$63, and Column F is headed 23/11/09, then the formula will give the date)
3. then finally, calculate the time between that date and the present time
I've tried various different things, both in normal Excel and the VBA editor, and I'm beginning to think maybe this isn't even possible.
I have a list of ID's on one sheet that are also located in a large matrix on another sheet.
This macro uses the Find_Range function to find each ID within the matrix and return the column header where the ID was first located. There is also a line which return a list of ranges, indicating all the places where the ID was found.
What I want is to convert the list of ranges into a list of corresponding column headers (ie row 1 of all columns in the range)
' Number of id's in list RowCnt = Application.WorksheetFunction. CountA(Columns("A"))
For I = 2 To RowCnt
LookFor = Sheets("ID List").Range("A" & I) Set InRng = Sheets("Matrix").Cells Set Found = Find_Range(LookFor, InRng, xlValues, xlWhole) On Error Resume Next ' If value is not found Sheets("RateID Count").Range("C" & I) = Sheets("Matrix") _ .Cells(1, Range(Found.Address).Column) ' Return column header Sheets("ID List").Range("D" & I) = Found.Address(False, False) ' Return cell address or range of addresses On Error Goto 0
If i lookup a value in the range A1:A12, say Sep-12, i need to get the cell address instead of the value of the row. but i know how to get cell address using CELL function. but i need to get cell address when i lookup the value.because lookup value will be dynamic.
Is there any formula to find text and return its cell address? This is like when we use Ctrl+F function to find a text, and Excel then highlight the cell contains the referred text. At the same time, the name-bar displays the address of the cell. Now, is there any formula that can perform such task like this?
I am trying to return a cell address range based on values in different columns. Attached is an example.
In Column A1 I have "Range" and below that a set of numbers from 1 to 31.
In Column B1 the name "Test" is used as an identifier, below that are the letters "a" though to "e". Once the letter "e" is reached the identifier "Test" is moved to column C "C6" and the alphabet continues from "f" down to "j". This process is repeated through the rest of the alphabet and the identifier moved to the next column after every 5th letter.
What I want to do is as follows:-
I would like to know the cell addresses of all instances of "test" from Column A numbers 6 throught to 24. The result should be C7:C12, D14:18 & D20:24. The results should ignore all instances of the identifier "test" and only return the cells which contain the letters of the alphabet.
I have tried using Vlookup which works well if the letters are all in the same column and I have incorporated the Address and Match formulas to return the range if all the alphabets are in the same column, but I do not know how to do this if the identifier "test" and letters move to a differnt column.
I'm very new to excel. I need a formula to put in a column (I) that returns ONLY a five-digit zip code from the adjacent cell in column J, which is a full address. Nearly every entry is written differently, and many do not contain a zip code. I would like the cell to be blank if the cell in J contains no zip code .
I'm using the formula: =MID(J5,MATCH(TRUE,ISNUMBER(-MID(SUBSTITUTE(J5,"","#"),ROW(INDIRECT("1:"&LEN(J5)-4)),5)),0),5)
This formula sometimes returns -**** format numbers, considering them to be negative and still five-digit. It also returns #N/A if no zip code is present, and I would like this to be blank. I'm sure I can nest the formula within an IFF, but have not been able to make it work myself.