Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Find Blank Excel Cells

  1. #1

    Thread Starter
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Resolved [RESOLVED] [2005] Find Blank Excel Cells

    I am trying to find out if the information in cell location is blank and if it is its fill the blank values with zeros. However with the logic I am using right now I never enter the inner part of the if check because its never blank.

    However I know the values in those cells are blank is there any other way to check to see the value in the cell locations.

    VB Code:
    1. 'Using Excel Reference determine how many columns are in the sheet.
    2.         For nCol = 1 To sheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell).Column
    3.             'If the row 6 and current column cell is blank
    4.             If sheet.Cells.Item(6, nCol).Equals("") Then
    5.                 If Not (sheet.Cells.Item(4, nCol).Equals("")) Then
    6.                     With Progress
    7.                         For nRow = 0 To Me._accPeriod
    8.                             'Displaying values from data into excel sheet.
    9.                             sheet.Cells.Item(nRow + 6, nCol) = 0
    10.                             sheet.Cells.Item(nRow + 6, 1 + nCol) = 0
    11.                             .ProgressBar.Value += 1
    12.                         Next nRow   'row increment
    13.                     End With
    14.                 End If  'None blank cell
    15.             End If  'Blank cell
    16.         Next nCol 'Total number of columns increment

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

  2. #2
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: [2005] Find Blank Excel Cells

    Quote Originally Posted by Jumpercables
    I am trying to find out if the information in cell location is blank and if it is its fill the blank values with zeros. However with the logic I am using right now I never enter the inner part of the if check because its never blank.

    However I know the values in those cells are blank is there any other way to check to see the value in the cell locations.

    VB Code:
    1. 'Using Excel Reference determine how many columns are in the sheet.
    2.         For nCol = 1 To sheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell).Column
    3.             'If the row 6 and current column cell is blank
    4.             If sheet.Cells.Item(6, nCol).Equals("") Then
    5.                 If Not (sheet.Cells.Item(4, nCol).Equals("")) Then
    6.                     With Progress
    7.                         For nRow = 0 To Me._accPeriod
    8.                             'Displaying values from data into excel sheet.
    9.                             sheet.Cells.Item(nRow + 6, nCol) = 0
    10.                             sheet.Cells.Item(nRow + 6, 1 + nCol) = 0
    11.                             .ProgressBar.Value += 1
    12.                         Next nRow   'row increment
    13.                     End With
    14.                 End If  'None blank cell
    15.             End If  'Blank cell
    16.         Next nCol 'Total number of columns increment
    Why not try sheet.Cells.Item(6, nCol).Value="" instead of sheet.Cells.Item(6, nCol).Equals("")

  3. #3
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: [2005] Find Blank Excel Cells

    If you want to know the value of the cell try typing these:

    VB Code:
    1. sheet.Cells.Item(6, nCol).Value

  4. #4

    Thread Starter
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Re: [2005] Find Blank Excel Cells

    VB Code:
    1. sheet.Cells.Item(6, nCol).Value

    Apparently I missed that thanks guys and gals!

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

Posting Permissions

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



Click Here to Expand Forum to Full Width