+ Reply to Thread
Results 1 to 4 of 4

Fill blank cells with 0 or alternative number

  1. #1
    Forum Contributor
    Join Date
    03-22-2006
    Location
    UK
    MS-Off Ver
    Office 2013
    Posts
    275

    Fill blank cells with 0 or alternative number

    Hi all

    I have a worksheet which is basically just for data entry; however some entries only require minimal data, leaving the cells in 3 columns blank.

    I have just come across this code in another post (courtesy of Simon Lloyd) which is ideal for general purposes.

    Please Login or Register  to view this content.
    Ideally I would like to customise this code to do the following:

    1) Restrict the range selection for use with columns D / E / F on Sheet1 for example, so that the range selection stops at the last filled cell in column C.

    2) It may be necessary to change the zero value in either D / E / F at a later date, so I would like the code to have individual values for each column, if that makes sense.

    3) This is not essential but can the code be set to run on a row by row basis for that specific worksheet. In other words, if there is no entries in D / E / F of row 25, when you move down to row 26, the zero input is automatically filled in rather than invoking a macro at the end.

    Please note my knowledge of VBA is virtually zero!

    TIA ...spellbound
    Last edited by VBA Noob; 09-14-2008 at 04:21 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    Try

    Please Login or Register  to view this content.
    for your first two questions.

  3. #3
    Forum Contributor
    Join Date
    03-22-2006
    Location
    UK
    MS-Off Ver
    Office 2013
    Posts
    275
    Hi Martin

    Thanks for your speedy response, it seems to be working fine.

    I have set all the MyCell.Value to zero for the time being.

    I wanted to make the Macro specific to one worksheet, which I did by just adding the code via the worksheet tab with no apparent problems.

    In order to make the Macro connection with that worksheet, is there any of amending the Macro name as I could not see any way of doing this.

    At the moment VBA has assigned the name as Sheet5.Fill_Blanks to the macro, whereas I would prefer to call it Input2.Fill_Blanks which is the name of the actual worksheet.

    Only a small point but it helps with identification.

    spellbound

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    Worth trying changing the name of the sheet. In the VBA editor, open the properties window (F4) and change the name which is in the top row.

+ 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. Auto fill blank cells with data in a cell above
    By StudentMod in forum Excel General
    Replies: 4
    Last Post: 05-09-2008, 04:37 PM
  2. Replies: 3
    Last Post: 11-22-2007, 07:53 AM
  3. Skipping blank cells in a list to create an uninterrupted list
    By bdance in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-02-2007, 06:26 PM
  4. Locking non blank cells in range
    By chris100 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-13-2007, 08:22 PM
  5. Replies: 0
    Last Post: 09-27-2006, 02:05 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