[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:
'Using Excel Reference determine how many columns are in the sheet.
For nCol = 1 To sheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell).Column
'If the row 6 and current column cell is blank
If sheet.Cells.Item(6, nCol).Equals("") Then
If Not (sheet.Cells.Item(4, nCol).Equals("")) Then
With Progress
For nRow = 0 To Me._accPeriod
'Displaying values from data into excel sheet.
sheet.Cells.Item(nRow + 6, nCol) = 0
sheet.Cells.Item(nRow + 6, 1 + nCol) = 0
.ProgressBar.Value += 1
Next nRow 'row increment
End With
End If 'None blank cell
End If 'Blank cell
Next nCol 'Total number of columns increment
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:
'Using Excel Reference determine how many columns are in the sheet.
For nCol = 1 To sheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell).Column
'If the row 6 and current column cell is blank
If sheet.Cells.Item(6, nCol).Equals("") Then
If Not (sheet.Cells.Item(4, nCol).Equals("")) Then
With Progress
For nRow = 0 To Me._accPeriod
'Displaying values from data into excel sheet.
sheet.Cells.Item(nRow + 6, nCol) = 0
sheet.Cells.Item(nRow + 6, 1 + nCol) = 0
.ProgressBar.Value += 1
Next nRow 'row increment
End With
End If 'None blank cell
End If 'Blank cell
Next nCol 'Total number of columns increment
Why not try sheet.Cells.Item(6, nCol).Value="" instead of sheet.Cells.Item(6, nCol).Equals("")
Re: [2005] Find Blank Excel Cells
If you want to know the value of the cell try typing these:
VB Code:
sheet.Cells.Item(6, nCol).Value
Re: [2005] Find Blank Excel Cells
VB Code:
sheet.Cells.Item(6, nCol).Value
Apparently I missed that thanks guys and gals!