ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Changing chosen numbers globally via popup (https://www.excelbanter.com/excel-discussion-misc-queries/254888-changing-chosen-numbers-globally-via-popup.html)

Colin Hayes

Changing chosen numbers globally via popup
 

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.

Colin Hayes

Changing chosen numbers globally via popup
 
In article , joel
writes

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


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com