+ Reply to Thread
Results 1 to 3 of 3

use macro to find and replace specific code in vba

  1. #1
    Registered User
    Join Date
    10-25-2013
    Location
    canada
    MS-Off Ver
    Excel 2007
    Posts
    79

    use macro to find and replace specific code in vba

    i am wondering if it is possible to have a macro that opens the vbe for the active worksheet, finds the code line
    Please Login or Register  to view this content.
    and replaces it with
    Please Login or Register  to view this content.
    or something similar.

    what i am trying to accomplish is have a macro permanently change the position and height of the active worksheet. when i run the macro it should go into the "This Workbook" excel object module for the active workbook, find the specific line of code (no matter its location in the code), and subtract "9" from its current value

    thanks

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: use macro to find and replace specific code in vba

    Hi,

    Can't you just use the VBE editor and use Find/Replace?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: use macro to find and replace specific code in vba

    Hi Hopeful,

    Try the attached file (tested using Excel 2003), with full code following. It is MANDATORY that the PREREQUISITES exist, or the code will not compile and/or you will get runtime errors. I want to thank all those who provided the referenced links. Without those links, I wouldn't have known where to start.

    Lewis

    In an ordinary code module:
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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 macro, modifying code in engagement
    By alan audit in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-28-2014, 04:56 AM
  2. Macro to find header information and replace with specific text
    By Nancy Taylor in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-15-2013, 04:47 PM
  3. Macro Find and Replace Code
    By ecloje in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2010, 12:46 PM
  4. [SOLVED] Find and Replace Macro Based on Specific Cells
    By EvoDE in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-12-2009, 06:31 PM
  5. Replies: 7
    Last Post: 03-03-2008, 11:48 AM

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