+ Reply to Thread
Results 1 to 8 of 8

Find/Replace all in VBA by using VBA code?

  1. #1
    Registered User
    Join Date
    08-05-2014
    Location
    Bangalore
    MS-Off Ver
    2010
    Posts
    11

    Question Find/Replace all in VBA by using VBA code?

    Hi all,

    I am new to macro and learning based on my activity.

    I have created for macro for weekly report and its worked fine.
    But I am facing one issue, ie.
    Every week I need to change only few things in code which wrote already (ex: this week is WW32_M and for next week I need to change WW33_M)

    So what I am searching for before proceed/start my macro code it should ask for dialog box to “find what and what to replace” and it will “replace all” in my code.

    After replaced then my vba code should start.

    Pl guide/help me on this.

    Thanks.

  2. #2
    Registered User
    Join Date
    04-26-2013
    Location
    banglore
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Find/Replace all in VBA by using VBA code?

    Sub FRVBA()
    Dim str As String
    Dim str1 As Integer
    str1 = InputBox("Enter the desired Value", "Attention")
    str = "WW" & str1 & "_M"
    MsgBox str
    End Sub

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,965

    Re: Find/Replace all in VBA by using VBA code?

    Post the code or maybe a workbook:
    To attach a Workbook
    (please do not post pictures or links)
    • Click Advanced (next to quick post),
    • Scroll down until you see "Manage Attachments",
    • Click that then select "add files" (top right corner).
    • Click "Select Files" find your file, click "open" click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Click "Done" at bottom right to close the Attachment Manager.
    • Click "Submit Reply"
    Ben Van Johnson

  4. #4
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Find/Replace all in VBA by using VBA code?

    Unless you really need to change a lot of code, if it is just certain variables i.e. WW32_M

    then use a cell in a sheet and use that in your code. Then all you need to do is change that one cell instead of changing your code.
    You can always hide the sheet from prying eyes.

    i.e. on sheet5 A1 enter WW32_M

    in your code

    Please Login or Register  to view this content.
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  5. #5
    Registered User
    Join Date
    08-05-2014
    Location
    Bangalore
    MS-Off Ver
    2010
    Posts
    11

    Re: Find/Replace all in VBA by using VBA code?

    Hi Thanks for all your support,

    but its changed in formulas and that formula is not updated properly.

    any idea for this.

    it should replace in formula too without changes required formula.

    --Sampath

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,965

    Re: Find/Replace all in VBA by using VBA code?

    I asked you to post your code because everyone is just guessing what you are working with.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Find/Replace all in VBA by using VBA code?

    I'm pretty sure this can be handle without a find/replace.

    Post the code.
    If posting code please use code tags, see here.

  8. #8
    Registered User
    Join Date
    08-05-2014
    Location
    Bangalore
    MS-Off Ver
    2010
    Posts
    11

    Re: Find/Replace all in VBA by using VBA code?

    Hi,

    Thanks for all your support.

    I got the code after several searches.

    My Macro is working fine.

    Thanks a lot again.

    --Sampath

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find and Replace Code in VBE on Open
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-11-2013, 12:14 PM
  2. Find and Replace code help
    By missy22 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 08:32 AM
  3. Find and replace in VBA Code
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-15-2012, 01:33 PM
  4. How to Update One Tab With Find & Replace VBA Code???
    By SEOT in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-28-2008, 08:21 PM
  5. [SOLVED] Code to modify find/replace
    By mcphc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2006, 12:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1