From: Colin Hayes on 2 Feb 2010 18:03 HI All Gary's Student kindly made some to code to allow input of variables via popup : Dim colstring As String Dim findit As Double, replacewith As Double colstring = Application.InputBox("Select Column ....", "Stage 1 of 3", Type:=2) findit = Application.InputBox("Column Selected : " & colstring & vbCr & vbCr & "Select Value To Replace?", "Stage 2 of 3", Type:=1) replacewith = Application.InputBox("Column Selected : " & colstring & vbCr & vbCr & "Value Selected : " & findit & vbCr & vbCr & "Replacement?", "Stage 3 of 3", Type:=1) Columns(colstring).Select Selection.Replace What:=findit, Replacement:=replacewith, LookAt:=xlWhole, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False This allows selection of a column (colstring) , then a specific value within in it (findit), and then replacement of that value with an input (replacewith). So , in the example of the code above , column A could be chosen where cells value 6.50 are replaced with 8.50. A 6.50 8.50 Could this be extended so that a second column is requested , and then an additional value and only where a match is found would the replacement be made? For example Column B could be chosen by popup , and a value say of Green. The column A could be chosen with a value of 6.50. Those cells which match both criteria in A are them replaced with 8.50 B Green A 6.50 8.50 Cells which have Green in column B which are at of 6.50 in column A are replaced with 8.50 in Column A can someone help with this? Best Wishes
|
Pages: 1 Prev: what is ^ function Next: Adjust text to fit within an Excel Cell using C# |