View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Using Popups to supply variables

I just tested his code with answers as follows:
d:e
5
4
worked just fine

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Colin Hayes" wrote in message
...
In article , Gary''s
Student writes
Sub colin()
Dim colstring As String
Dim findit As Double, replacewith As Double
colstring = Application.InputBox(prompt:="which columns?", Type:=2)
findit = Application.InputBox(prompt:="which value to replace?", Type:=1)
replacewith = Application.InputBox(prompt:="replacement?", Type:=1)
Columns(colstring).Select
Selection.Replace What:=findit, Replacement:=replacewith, LookAt:=xlPart,
_
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub


Hi

OK thanks for your help. I tried it out and it gives an error at the final
hurdle , unfortunately.

I hope I copied over the code properly , as it's all wrapped and I had to
unpick.

This is what I used:

Dim colstring As String
Dim findit As Double, replacewith As Double
colstring = Application.InputBox(prompt:="which columns?", Type:=2)
findit = Application.InputBox(prompt:="which value to replace?", Type:=1)
replacewith = Application.InputBox(prompt:="replacement?", Type:=1)
Columns(colstring).SelectSelection.Replace What:=findit,
replacement:=replacewith, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False


It gives an error 'Object doesn't support this property or method'. The
debugger highlights the section from Columns(colstring) onwards.

Hope you can help.



Best Wishes