Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need to find a static value in a cell and then subtract from adjacent cell
Hello,
I'm trying to write a macro that will look at a series of cells for a specific word. If the word it is found, it will subtract the value from the cell adjacent to the cell it found the word in. For instance, loop through cells E32 - E42. If word, "Paul" is found in cell E32, subtract value in cell F32 from cell D25. Otherwise if word, "Paul" is found in cell E33, subtract value in cell F33 from cell D25. If "Paul" is found in E32 and E33, subtract values in F32 and F33 from D25. D25 is static. The value to subtract is dynamic based on the values in column E. Please help! Thanks, Jihaan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need to find a static value in a cell and then subtract from adjacent cell
jihaan wrote:
I'm trying to write a macro that will look at a series of cells for a specific word. If the word it is found, it will subtract the value from the cell adjacent to the cell it found the word in. For instance, loop through cells E32 - E42. If word, "Paul" is found in cell E32, subtract value in cell F32 from cell D25. Otherwise if word, "Paul" is found in cell E33, subtract value in cell F33 from cell D25. If "Paul" is found in E32 and E33, subtract values in F32 and F33 from D25. D25 is static. The value to subtract is dynamic based on the values in column E. You practically wrote the code yourself: For n = 32 To 42 If InStr(Cells(n, 5).Value, "Paul") Then Range("D25").Value = Range("D25").Value - Cells(n, 6).Value End If Next -- It's what I call an Insult of Opportunity. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find duplicate, but only if an adjacent cell is identical | Excel Worksheet Functions | |||
find lowest number and return it's adjacent cell | Excel Worksheet Functions | |||
Find a cell and then insert a formula into adjacent cell | Excel Programming | |||
find data in adjacent cell | Excel Discussion (Misc queries) | |||
Find Cell and Copy adjacent value to another location | Excel Programming |