Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
xlDialogFormulaReplace
So I've discovered this:
xlDialogFormulaReplace which will allow me to prompt for the replace window (thank you to those whom offered answers to my questions). Now I still have a question unanswered though. How do I default the value of the Replace What field? |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
xlDialogFormulaReplace
that should be
How do I default the value of the Find What field "Greegan" wrote in message ... So I've discovered this: xlDialogFormulaReplace which will allow me to prompt for the replace window (thank you to those whom offered answers to my questions). Now I still have a question unanswered though. How do I default the value of the Replace What field? |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
xlDialogFormulaReplace
I'll be up front - I haven't found the answer for your question. the
defaults for the dialog boxes are down deep and there doesn't seem to be an easy way to get to them. A wiser head may prevail later. But, from reading your other questions it appears that you want to toss up a dialog when the user tries to close/save the workbook and change some text throughout the workbook before closing it. You say you know where that needs to go. You also indicate that you don't want them to continue without entering something. So... Try this code to use the Cells.Find method to make the changes Dim NewTextForReplacing As String Dim WhereAmI As String Dim AnySheet As Object WhereAmI = ActiveSheet.Name 'save your place Do Until NewTextForReplacing < "" NewTextForReplacing = InputBox("Please enter your name to continue...", "Title: Name for file", "") Loop Application.ScreenUpdating = False For Each AnySheet In Worksheets AnySheet.Activate Cells.Replace What:="Some Strange Text", Replacement:=NewTextForReplacing, _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _ False, ReplaceFormat:=False Next Application.ScreenUpdating = True what that does is force them to enter something before they can go on. Until they do enter something the NewTextForReplacing variable remains empty and the input box stays up even if they use 'x' to close it or hit the [Cancel] button. If you want to allow them to continue without entering a phrase, then take that out of the loop and examine NewTextForReplacing for an empty string after that and if it is empty, do what ever it is you want. Look at the InputBox in Excel Help to get more ideas on how to use it, especially the Default option. The code above will go through all of the worksheets in the book and perform the replace throughout it. Hope this provides you with some assistance. "Greegan" wrote: that should be How do I default the value of the Find What field "Greegan" wrote in message ... So I've discovered this: xlDialogFormulaReplace which will allow me to prompt for the replace window (thank you to those whom offered answers to my questions). Now I still have a question unanswered though. How do I default the value of the Replace What field? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|