Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 465
Default Using Popups to supply variables



Hi All

I sue this macro to find and replace a number in column I


Columns("I:I").Select
Selection.Replace What:="5.95", Replacement:="2.95", LookAt:=xlPart,
_
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False


I'd like to replace the values in the macro , requesting variable input
via popup. Can someone help?

Effectively , there would be popups to request the column , the search
number and the replace number.

If it could also cycle back to the beginning on completion (unless
cancelled) that would be helpful too.

Grateful for any advice.



Best Wishes

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Using Popups to supply variables

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

--
Gary''s Student - gsnu201001


"Colin Hayes" wrote:



Hi All

I sue this macro to find and replace a number in column I


Columns("I:I").Select
Selection.Replace What:="5.95", Replacement:="2.95", LookAt:=xlPart,
_
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False


I'd like to replace the values in the macro , requesting variable input
via popup. Can someone help?

Effectively , there would be popups to request the column , the search
number and the replace number.

If it could also cycle back to the beginning on completion (unless
cancelled) that would be helpful too.

Grateful for any advice.



Best Wishes

.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 465
Default Using Popups to supply variables

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
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 465
Default Using Popups to supply variables

In article , Don Guillett
writes
I just tested his code with answers as follows:
d:e
5
4
worked just fine


Hi Don

OK I ran it again , using

I:I
5.95
3.95

and got the same 'Object doesn't support this property or method' errors
I'm afraid.

Whatever I try it gives the same errors , which is frustrating. The code
is wrapped and hard to unpick but I'll keep trying. Glad you got it
going at least.



Best Wishes
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 465
Default Using Popups to supply variables


Hi

OK this is fixed and working fine now - thanks for your help. Much
appreciated.

Regards




In article , Colin Hayes
writes
In article , Don Guillett
writes
I just tested his code with answers as follows:
d:e
5
4
worked just fine


Hi Don

OK I ran it again , using

I:I
5.95
3.95

and got the same 'Object doesn't support this property or method' errors
I'm afraid.

Whatever I try it gives the same errors , which is frustrating. The code
is wrapped and hard to unpick but I'll keep trying. Glad you got it
going at least.



Best Wishes


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Months of supply Steve Excel Discussion (Misc queries) 5 March 4th 09 07:04 PM
Customising Standard Popups Colin Hayes Excel Discussion (Misc queries) 10 May 28th 07 02:50 AM
Amending standard Excel popups Colin Hayes Excel Worksheet Functions 4 May 12th 07 06:32 PM
Disabling security popups Colin Hayes Excel Worksheet Functions 0 April 9th 07 02:29 PM
Automated Popups Brad.R.Sutton Excel Worksheet Functions 1 April 12th 06 03:57 PM


All times are GMT +1. The time now is 11:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"