Home |
Search |
Today's Posts |
#1
|
|||
|
|||
ques
Hi.
I new in vba+excell I need to check if any data was inserted in column 13D - 19D so I wrote: Private Function check() As Boolean Dim intCodeIndex As Integer Dim checkCode As Boolean intCodeIndex = 13 checkCode = False While Not Cells(intCodeIndex, "D") = vbNullString ' I need to improve this line. checkCode = True GoTo SUB_EXIT intCodeIndex = intCodeIndex + 1 Wend checkCode = False SUB_EXIT: check = checkCode End Function I need one value in column "D" - so the func return true. the problem is - if there is not value in row13 the func return false - although there could be value in row 19. in order to return FALSE there must be no value in any row 13-19 how can I improve it to be fast and check all the row in column "D". Thanks. |
#2
|
|||
|
|||
Hi
Define a named range (Insert - Name - Define from menu), p.e. Check Check=(COUNTIF(Sheet1!$D$13:$D$19,"<")0) Now anywhere in workbook, you can check for any numeric or character entry in range Sheet1!$D$13:$D$19 like this: =IF(Check, Expression1, Expression2) In VBA, you can check for entries in same range like this: If [Check] then Statements Else Statements End If Arvi Laanemets "maya" wrote in message ... Hi. I new in vba+excell I need to check if any data was inserted in column 13D - 19D so I wrote: Private Function check() As Boolean Dim intCodeIndex As Integer Dim checkCode As Boolean intCodeIndex = 13 checkCode = False While Not Cells(intCodeIndex, "D") = vbNullString ' I need to improve this line. checkCode = True GoTo SUB_EXIT intCodeIndex = intCodeIndex + 1 Wend checkCode = False SUB_EXIT: check = checkCode End Function I need one value in column "D" - so the func return true. the problem is - if there is not value in row13 the func return false - although there could be value in row 19. in order to return FALSE there must be no value in any row 13-19 how can I improve it to be fast and check all the row in column "D". Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|