+ Reply to Thread
Results 1 to 3 of 3

Fill in the blanks!

  1. #1
    Bhupinder Rayat
    Guest

    Fill in the blanks!

    Hi All,

    I have a range of cells (i.e. A1:D5), some cells contain values and others
    are blank cells.

    I want to create a piece of code that checks each cell in the range. If a
    cell is blank is blank then insert a 0, and if a cell contains a value then
    ignore it and move onto the next cell.

    Can anyone help at all?

    Many thanks,

    Pinda.

  2. #2
    Gary''s Student
    Guest

    RE: Fill in the blanks!

    This runs off any range you select:

    Sub Macro1()
    Dim r As Range
    For Each r In Selection
    If IsEmpty(r.Value) Then
    r.Value = 0
    End If
    Next
    End Sub


    --
    Gary''s Student


    "Bhupinder Rayat" wrote:

    > Hi All,
    >
    > I have a range of cells (i.e. A1:D5), some cells contain values and others
    > are blank cells.
    >
    > I want to create a piece of code that checks each cell in the range. If a
    > cell is blank is blank then insert a 0, and if a cell contains a value then
    > ignore it and move onto the next cell.
    >
    > Can anyone help at all?
    >
    > Many thanks,
    >
    > Pinda.


  3. #3
    Bhupinder Rayat
    Guest

    RE: Fill in the blanks!

    works a treat, thank you

    Apologies for the repeated thread, I wasn't getting the prompt box to say my
    message had been posted.

    Thanks again,

    Pinda.

    "Gary''s Student" wrote:

    > This runs off any range you select:
    >
    > Sub Macro1()
    > Dim r As Range
    > For Each r In Selection
    > If IsEmpty(r.Value) Then
    > r.Value = 0
    > End If
    > Next
    > End Sub
    >
    >
    > --
    > Gary''s Student
    >
    >
    > "Bhupinder Rayat" wrote:
    >
    > > Hi All,
    > >
    > > I have a range of cells (i.e. A1:D5), some cells contain values and others
    > > are blank cells.
    > >
    > > I want to create a piece of code that checks each cell in the range. If a
    > > cell is blank is blank then insert a 0, and if a cell contains a value then
    > > ignore it and move onto the next cell.
    > >
    > > Can anyone help at all?
    > >
    > > Many thanks,
    > >
    > > Pinda.


+ 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