+ Reply to Thread
Results 1 to 21 of 21

Find blank Cell and paste from certain cell

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Find blank Cell and paste from certain cell

    Hello:

    I have excel sheet with data in cell N3:O8
    Some of the cells may be blank.
    I need a VB Code to check if any of the cells are blank and if any cell is blank then copy the content of cell N9 and paste in the blank cell.

    Please let me know if any questions.

    Thank you

    Riz Momin
    Last edited by rizmomin; 06-10-2013 at 03:22 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Find blank Cell and paste from certain cell

    Hi
    Paste this code into a Module in your workbook:
    Sub FillEmptyBlankCellWithValue()
    'Fill an empty or blank cell in selection
    'with value specified in Cell N9
    Dim cell As Range
    Dim InputValue As String
    Dim Val
    Val = Cells.Range("N9")
    On Error Resume Next
    For Each cell In Selection
    If IsEmpty(cell) Then
    cell.Value = Val
    End If
    Next
    End Sub
    Then select the range N3 to O8 and then run the macro.
    Tony

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find blank Cell and paste from certain cell

    Riz,
    Try

    Please Login or Register  to view this content.

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Find blank Cell and paste from certain cell

    option
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Find blank Cell and paste from certain cell

    Hi AB33:

    Thank u, you code will work great for me.

    Riz Momin

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find blank Cell and paste from certain cell

    Riz,
    You are welcome!

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Find blank Cell and paste from certain cell

    Hi AB33:

    I need 1 more criteria added when pasting the content of N9 to blank cell.
    N9 is non-colored cell and i want to make sure that when replacing blank cell with contents of N9 then the cell of the blank cell should be non-colored.

    Please let me know if any questions.

    Thank you

    Riz Momin

  8. #8
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Find blank Cell and paste from certain cell

    Hello rizmomin,

    The code which AB33 gave you does not transfer Cell Interior Color, so no need to worry about that, unless you have conditional Formatting applied to that Range.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find blank Cell and paste from certain cell

    Riz,
    I think Winon has replied to your question. The code pastes values, (not formatting) only

  10. #10
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Find blank Cell and paste from certain cell

    Hi AB33:

    How would i paste values with formatting?
    I want the interior color and the value of N9 to be pasted.
    Please help and let me know if any questions.

    Thank you

    Riz Momin
    Last edited by rizmomin; 06-10-2013 at 01:55 PM.

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find blank Cell and paste from certain cell

    Please Login or Register  to view this content.
    Last edited by AB33; 06-10-2013 at 02:31 PM.

  12. #12
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Find blank Cell and paste from certain cell

    Hello Riz,

    With AB33's permission, change the Code as Follow;

    Please Login or Register  to view this content.

  13. #13
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Find blank Cell and paste from certain cell

    @ AB33,

    Sorry, you were faster than me.

  14. #14
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find blank Cell and paste from certain cell

    Winon,
    You have killed two birds with stone. I forget the method XLpasteall.

  15. #15
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Find blank Cell and paste from certain cell

    Hi AB33 and Winon:

    Please refer to attached sheet.
    As you can see that the value of N9 is blank and non-color.
    I want the same to go to any blank cells between N3:O8.
    Its not working like i want with the code.

    Please have a look and let me know if any questions.

    Thank you

    Riz Momin
    Attached Files Attached Files

  16. #16
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Find blank Cell and paste from certain cell

    @ AB33,

    Thank you for the feedback, and that you don't mind me butting in. We are all here to learn and help where we can.

    It is also a good idea to remember to add;

    Please Login or Register  to view this content.
    Glad to have you as a member of this great Forum!

  17. #17
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find blank Cell and paste from certain cell

    Riz,
    On the attached Range N9 is blank. Is this right?

  18. #18
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find blank Cell and paste from certain cell

    Two codes: Mine and Winon's

    Please Login or Register  to view this content.
    Last edited by AB33; 06-10-2013 at 02:58 PM.

  19. #19
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Find blank Cell and paste from certain cell

    Hi AB33 and Winon:

    Thanks a lot to both of you for great help.
    It works.

    Thank you

    Riz Momin

  20. #20
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Find blank Cell and paste from certain cell

    Hello Riz,

    You are welcome, glad we could help.

    Thank you for the "Rep".

    @ AB33,

    Nice working with you.

  21. #21
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find blank Cell and paste from certain cell

    Winon and Riz,
    You are always welcome!

+ 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