Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to search range for a portion of a specific value and if findit - then paste formula in another cell.
The below formula works as written for a set value of "66-1007" in column B.. My problem is I need to search for a portion of that value as the 66-10 will remain constant, but the last 2 numbers might change (it is always a 7 character field). I have tried the * and # variables and have not had luck. Any help would be appreciated.
With Sheets("myworkshet") Set rngToSearch = .Range(.Range("B2"), _ .Cells(Rows.Count, "B").End(xlUp)) End With For Each rng In rngToSearch With rng If .Value = "66-1007" Then Cells(.Row, "K").FormulaR1C1 = "=(RC[6]+RC[7])*0.08615" End If End With Next rng |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to search range for a portion of a specific value and if find it - then paste formula in another cell.
On Tue, 5 Mar 2013 13:32:26 -0800 (PST), JenIT wrote:
The below formula works as written for a set value of "66-1007" in column B. My problem is I need to search for a portion of that value as the 66-10 will remain constant, but the last 2 numbers might change (it is always a 7 character field). I have tried the * and # variables and have not had luck. Any help would be appreciated. With Sheets("myworkshet") Set rngToSearch = .Range(.Range("B2"), _ .Cells(Rows.Count, "B").End(xlUp)) End With For Each rng In rngToSearch With rng If .Value = "66-1007" Then Cells(.Row, "K").FormulaR1C1 = "=(RC[6]+RC[7])*0.08615" End If End With Next rng Look at help for Like: Try: if .value like "66-10##" then |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to search range for a portion of a specific value and iffind it - then paste formula in another cell.
Perfect!!!! Thanks - amazing how one little word makes a world of difference. Your help is much appreciated.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search for specific text within last non blank cell in a range | Excel Worksheet Functions | |||
Formula to Search one specific cell on another sheet. | Excel Discussion (Misc queries) | |||
Extract a specific portion of text as new cell value | Excel Discussion (Misc queries) | |||
I need to search for then extract a specific portion of cell data... | Excel Worksheet Functions | |||
I need to search for then extract a specific portion of cell data... | Excel Programming |