Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Blank Cells in A Range default to O? - Clarification

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    17
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Here is the code I currently use to fit my situation. It seems very repititious. There is probably an easier way to do this but this is the only way I have found that will work.

    I have used the "Edit GoTo Special Blanks" method without success. So here it is - my masterpiece!

    If Range("E42").Value < 1 Then
    Range("E42").Value = "=0"
    End If
    If Range("g42").Value < 1 Then
    Range("g42").Value = "=0"
    End If
    If Range("i42").Value < 1 Then
    Range("i42").Value = "=0"
    End If
    If Range("k42").Value < 1 Then
    Range("k42").Value = "=0"
    End If
    If Range("m42").Value < 1 Then
    Range("m42").Value = "=0"
    End If
    If Range("o42").Value < 1 Then
    Range("o42").Value = "=0"
    End If
    If Range("q42").Value < 1 Then
    Range("q42").Value = "=0"
    End If
    If Range("s42").Value < 1 Then
    Range("s42").Value = "=0"
    End If
    If Range("u42").Value < 1 Then
    Range("u42").Value = "=0"
    End If
    If Range("w42").Value < 1 Then
    Range("w42").Value = "=0"
    End If
    If Range("y42").Value < 1 Then
    Range("y42").Value = "=0"
    End If
    If Range("aa42").Value < 1 Then
    Range("aa42").Value = "=0"
    End If
    If Range("ac42").Value < 1 Then
    Range("ac42").Value = "=0"
    End If
    If Range("aE42").Value < 1 Then
    Range("aE42").Value = "=0"
    End If
    If Range("ag42").Value < 1 Then
    Range("ag42").Value = "=0"
    End If
    If Range("AI42").Value < 1 Then
    Range("ai42").Value = "=0"
    End If
    If Range("Ak42").Value < 1 Then
    Range("ak42").Value = "=0"
    End If
    If Range("Am42").Value < 1 Then
    Range("am42").Value = "=0"
    End If
    If Range("Ao42").Value < 1 Then
    Range("ao42").Value = "=0"
    End If
    If Range("Aq42").Value < 1 Then
    Range("aq42").Value = "=0"
    End If
    If Range("As42").Value < 1 Then
    Range("as42").Value = "=0"
    End If
    If Range("Au42").Value < 1 Then
    Range("au42").Value = "=0"
    End If
    If Range("Aw42").Value < 1 Then
    Range("aw42").Value = "=0"
    End If
    If Range("Ay42").Value < 1 Then
    Range("ay42").Value = "=0"
    End If
    If Range("BA42").Value < 1 Then
    Range("BA42").Value = "=0"
    End If
    If Range("BC42").Value < 1 Then
    Range("BC42").Value = "=0"
    End If
    If Range("Be42").Value < 1 Then
    Range("Be42").Value = "=0"
    End If
    If Range("Bg42").Value < 1 Then
    Range("Bg42").Value = "=0"
    End If
    If Range("Bi42").Value < 1 Then
    Range("Bi42").Value = "=0"
    End If
    If Range("Bk42").Value < 1 Then
    Range("Bk42").Value = "=0"
    End If

    End Sub

    Thanks for any help anyone may have to offer - this runs on a spreadsheet where people enter numbers and text. I want it to update as entries are made so I Call this Procedure from my Workheet.

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    This should accomplish the same thing...


    Dim cCol
    For cCol = 5 To 59 Step 2
    If Cells(42, cCol).Value < 1 Then _
    Cells(42, cCol).Value = 0
    Next




    if you don't want the 0 and want to leave it blank then use this:



    Dim cCol
    For cCol = 5 To 59 Step 2
    If Cells(42, cCol).Value < 1 Then _
    Cells(42, cCol).Value = ""
    Next


    [ This Message was edited by: TsTom on 2002-04-26 04:42 ]

  3. #3
    New Member
    Join Date
    Mar 2002
    Posts
    17
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for the help. I really need the 0. That was the whole point of this! Nice to have somewhere to go for help - what a lifesaver.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •