+ Reply to Thread
Results 1 to 3 of 3

Find and replace macro misbehaving

  1. #1
    Registered User
    Join Date
    05-19-2012
    Location
    basingstoke, england
    MS-Off Ver
    Excel 2010
    Posts
    2

    Find and replace macro misbehaving

    So I've recently learnt there's this thing called vba, and I'm trying to automate the update of one of the spreadsheets I use at work.

    I've manage to create new tabs, import pivot tables and make all the data generally lovely. The only problem is the summary page. I want to copy last quarters summary, paste it (easy peasy) then replace the title of the worksheet the data needs to be taken from. When I recorded the macro and replaced everything, it worked perfectly, so I assumed the macro would work. When I reversed my operations and ran the macro to do it, not only did it replace what I wanted it to replace, but it also filled every blank cell with the value I put in the replace bar. Is there a variable I need to declare in order to stop it filling blank cells? I've googled it but nothing relevant comes up.

    Thanks in advance,

    James

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Find and replace macro misbehaving

    Hello sheetman,

    Welcome to the Forum!

    Vaporware is difficult, if not impossible, to make corrections to. You can and should post the macro code. Please add any comments about what you expect the macro to do along with before and after results.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    05-19-2012
    Location
    basingstoke, england
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Find and replace macro misbehaving

    Please Login or Register  to view this content.
    This is the code I recorded to replace the old year and quarter to the new one. The range I have selected contains blank cells, and when I run the macro it fills these blank cells with CurrentYear&CurrentQuarter.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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