+ Reply to Thread
Results 1 to 13 of 13

Replacing Blank cells with Text

  1. #1
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Question Replacing Blank cells with Text

    Good morning All!!

    I am trying to work with the following code...

    Please Login or Register  to view this content.
    I thought I have declared everything I needed to. However, when I try and run the code, I get an error that states:
    Compile Error: Method or data member not found

    What did I do wrong? The objective is to replace the blanks in Column Y(named: Problem Reported) with Problem Not Reported. I have different worksheets within the main workbook that consist of different number of rows, so this code need to be able to accommodate that variant.

    Please HELP!!!!!

  2. #2
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Replacing Blank cells with Text

    Hi change Cout into Count
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  3. #3
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Replacing Blank cells with Text

    You spelt count wrong and you can't declare a variable as a cell, it needs to be a range

    Please Login or Register  to view this content.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  4. #4
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Replacing Blank cells with Text

    It could be even shorter You do not hava to set activeworksheet
    Please Login or Register  to view this content.

  5. #5
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Replacing Blank cells with Text

    Or...

    Please Login or Register  to view this content.
    Last edited by JapanDave; 06-27-2012 at 10:36 AM.

  6. #6
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Replacing Blank cells with Text

    Thank you everyone!!! These worked great!!!

  7. #7
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Replacing Blank cells with Text

    I actually have one more question relating to this...if I wanted to include a Trim function prior to checking for the blanks in this same cell range...what is the best way to do that?

  8. #8
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Replacing Blank cells with Text

    Using your code,

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Replacing Blank cells with Text

    Yes, that is the code I am using.

  10. #10
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Replacing Blank cells with Text

    There are some cells that have carriage returns in them.

  11. #11
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Replacing Blank cells with Text

    Quote Originally Posted by dwhite30518 View Post
    There are some cells that have carriage returns in them.
    That code uses the trim function. I just used what you were using to demonstrate. Try the code.

    Sorry, what is a carriage return?

  12. #12
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Replacing Blank cells with Text

    Take a look into cell A2...this is what I would like to fix. I have cells throughout the column that are like this and I would like to fix this without having to going into the cell and hitting the delete key until it is like the other cells.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Replacing Blank cells with Text

    I think if I were to add a line to clear the contents of the cell if the cell is blank then this would accomplish the goal....I just am not sure how or where it incorporate that function.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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