Changing chosen numbers globally via popup

C

Colin Hayes

Hi

I have a small task to carry out in Excel. I need a macro that will
offer popups requesting the following

a. Choose a column to operate on.

b. Enter a number to be found in that column.

c. Enter a number to update the number chosen in b.

d. Go back to start of macro at popup a , unless cancelled.


So , I might choose column D , all values at 7.30 to be updated to
12.50.


Can someone help with some code , please?


Grateful for any assistance.
 
J

joel

try this

Sub replacenumber()


Do
OldValue = InputBox("Enter Data to replace : ")
NewValue = InputBox("Enter Replacement Data : ")

Set mycell = Application.InputBox( _
prompt:="Select a Column", Type:=8)

mycell.Replace what:=OldValue, replacement:=NewValue, _
lookat:=xlPart


Msg = "Do you want to continue ?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define
buttons.
Title = "MsgBox Demonstration" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)

Loop While Response = vbYes




End Sub
 
C

Colin Hayes

joel said:
try this

Sub replacenumber()


Do
OldValue = InputBox("Enter Data to replace : ")
NewValue = InputBox("Enter Replacement Data : ")

Set mycell = Application.InputBox( _
prompt:="Select a Column", Type:=8)

mycell.Replace what:=OldValue, replacement:=NewValue, _
lookat:=xlPart


Msg = "Do you want to continue ?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define
buttons.
Title = "MsgBox Demonstration" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)

Loop While Response = vbYes




End Sub

Hi Joel

Thanks for your help.

I couldn't get it working , I'm afraid. I think there's some scrambling
in the email , and the remmed statements added confusion. I did
eventually have it running without VBA error , but it didn't actually
carry out the replacement as required.



Best Wishes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top