校验函数
Posted xiehaofeng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了校验函数相关的知识,希望对你有一定的参考价值。
1 ‘学籍接续标识 2 Function checkXjjxbs(valueCol As TypeValueColum, rowIndex) 3 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 4 5 End If 6 End Function 7 8 ‘1 学校标识码 9 Function checkXXsbh(valueCol As TypeValueColum, rowIndex) 10 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 11 isBeing = CheckValueLength(valueCol, rowIndex, 10, True) 12 If isBeing Then 13 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 14 If xxbsm <> value Then 15 errorMsg = "第" & rowIndex & "行的数据项:" & valueCol.columnName & "和输入的学校标识码不相同,请检查!" 16 writeLog (errorMsg) 17 End If 18 End If 19 End If 20 End Function 21 ‘2 姓名 22 Function checkXm(valueCol As TypeValueColum, rowIndex) 23 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 24 oldValue = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 25 newValue = Replace(oldValue, " ", "") 26 Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex).value = newValue 27 isBeing = CheckValueLength(valueCol, rowIndex, 30, False) 28 End If 29 30 End Function 31 ‘3 性别 32 Function checkXb(valueCol As TypeValueColum, rowIndex) 33 If valueCol.dicColumnIndex = 0 Then 34 MsgBox ("性别没有对应字典列检查,请联系管理员!") 35 Exit Function 36 End If 37 38 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 39 isBeing = DoDicCheck(valueCol, rowIndex) 40 End If 41 End Function 42 ‘4 出生日期 43 Function checkCsrq(valueCol As TypeValueColum, rowIndex) 44 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 45 beDate = CheckIsDate(valueCol, rowIndex) 46 End If 47 End Function 48 ‘5 出生地行政区划 49 Function checkCsrXzqh(valueCol As TypeValueColum, rowIndex) 50 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 51 isBeing = CheckValueLength(valueCol, rowIndex, 12, True) 52 If isBeing Then 53 IsNumber = checkBeNumeric(valueCol, rowIndex) 54 End If 55 End If 56 End Function 57 ‘6 籍贯 58 Function checkJg(valueCol As TypeValueColum, rowIndex) 59 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 60 isBeing = CheckValueLength(valueCol, rowIndex, 20, False) 61 End If 62 End Function 63 ‘7 民族 64 Function checkMz(valueCol As TypeValueColum, rowIndex) 65 If valueCol.dicColumnIndex = 0 Then 66 MsgBox ("民族没有对应字典列检查,请联系管理员!") 67 Exit Function 68 End If 69 70 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 71 isBeing = DoDicCheck(valueCol, rowIndex) 72 End If 73 End Function 74 ‘8 国籍/地区 75 Function checkGjdq(valueCol As TypeValueColum, rowIndex) 76 If valueCol.dicColumnIndex = 0 Then 77 MsgBox ("国籍/地区没有对应字典列检查,请联系管理员!") 78 Exit Function 79 End If 80 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 81 isBeing = DoDicCheck(valueCol, rowIndex) 82 End If 83 End Function 84 ‘9 身份证件类型 85 Function checkSfzjlx(valueCol As TypeValueColum, rowIndex) 86 If valueCol.dicColumnIndex = 0 Then 87 MsgBox ("身份证件类型没有对应字典列检查,请联系管理员!") 88 Exit Function 89 End If 90 91 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 92 isBeing = DoDicCheck(valueCol, rowIndex) 93 If isBeing Then 94 value = "居民身份证" 95 ‘‘Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 96 beID = IDcheck(Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex + 1)) 97 sfzjhValue = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex + 1) 98 If sfzjhValue = "" And value <> "其他" And value <> "" Then 99 errorMsg = "第" & rowIndex & "行的数据项:身份证件号不能为空,请检查!" 100 writeLog (errorMsg) 101 Exit Function 102 End If 103 Select Case value 104 Case "其他" 105 Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex + 1).value = "" 106 Case "居民身份证" 107 If beID = 0 Then 108 errorMsg = "第" & rowIndex & "行的数据项:身份证件号不正确,请检查!" 109 writeLog (errorMsg) 110 ElseIf beID = 1 Then 111 Else 112 Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex + 1).value = beID 113 End If 114 Case Else 115 If beID = "" Then 116 errorMsg = "第" & rowIndex & "行的数据项:身份证件号不能为空,请检查!" 117 writeLog (errorMsg) 118 End If 119 End Select 120 End If 121 End If 122 123 End Function 124 ‘10 港澳台侨外 125 Function checkGat(valueCol As TypeValueColum, rowIndex) 126 If valueCol.dicColumnIndex = 0 Then 127 MsgBox ("港澳台侨外没有对应字典列检查,请联系管理员!") 128 Exit Function 129 End If 130 131 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 132 isBeing = DoDicCheck(valueCol, rowIndex) 133 End If 134 End Function 135 ‘11 健康状况 136 Function checkJkzk(valueCol As TypeValueColum, rowIndex) 137 If valueCol.dicColumnIndex = 0 Then 138 MsgBox ("健康状况没有对应字典列检查,请联系管理员!") 139 Exit Function 140 End If 141 142 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 143 isBeing = DoDicCheck(valueCol, rowIndex) 144 End If 145 End Function 146 ‘12 政治面貌 147 Function checkZzmm(valueCol As TypeValueColum, rowIndex) 148 If valueCol.dicColumnIndex = 0 Then 149 MsgBox ("政治面貌没有对应字典列检查,请联系管理员!") 150 Exit Function 151 End If 152 153 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 154 isBeing = DoDicCheck(valueCol, rowIndex) 155 End If 156 End Function 157 ‘13 身份证件号 158 Function checkSfzjhm(valueCol As TypeValueColum, rowIndex) 159 sfzjlxStr = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex - 1) 160 If sfzjlxStr <> "居民身份证" Then 161 byteLen = checkByteLength(Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex)) 162 If byteLen > 18 Then 163 errorMsg = "第" & rowIndex & "行的数据项:身份证件号长度不能大于18个字符,请检查!" 164 writeLog (errorMsg) 165 End If 166 End If 167 End Function 168 ‘14 户口性质 169 Function checkHkxz(valueCol As TypeValueColum, rowIndex) 170 If valueCol.dicColumnIndex = 0 Then 171 MsgBox ("户口性质没有对应字典列检查,请联系管理员!") 172 Exit Function 173 End If 174 175 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 176 isBeing = DoDicCheck(valueCol, rowIndex) 177 End If 178 End Function 179 ‘‘15 户口所在地行政区划 180 Function checkHkszdXzqh(valueCol As TypeValueColum, rowIndex) 181 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 182 isBeing = CheckValueLength(valueCol, rowIndex, 12, True) 183 If isBeing Then 184 IsNumber = checkBeNumeric(valueCol, rowIndex) 185 End If 186 End If 187 End Function 188 ‘‘16 班号 189 Function checkBh(valueCol As TypeValueColum, rowIndex) 190 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 191 isBeing = CheckValueLength(valueCol, rowIndex, 7, True) 192 If isBeing Then 193 IsNumber = checkBeNumeric(valueCol, rowIndex) 194 If IsNumber Then 195 Dim jyjdInt As Integer 196 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 197 jyjdInt = Mid(value, 5, 1) 198 If jyjdInt <> 1 Then 199 errorMsg = "第" & rowIndex & "行的数据项:" & valueCol.columnName & "填写不正确(第5位表示教育阶段,1表示小学)!" 200 writeLog (errorMsg) 201 202 ‘Else 203 ‘ csrqValue = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex - 12) 204 ‘ Dim csrq As Date 205 ‘ csrq = Left(csrqValue, 4) & "/" & Mid(csrqValue, 5, 2) & "/" & Right(csrqValue, 2) 206 ‘ days = DateDiff("d", csrq, Now) 207 ‘ age = days / 365 208 ‘ If jyjdInt = 1 Then 209 ‘ If age < 5 Or age > 11 Then 210 ‘ errorMsg = "第" & rowIndex & "行的数据项: 该小学学生的年龄不在4岁到11岁之间,请检查!" 211 ‘ writeLog (errorMsg) 212 ‘ End If 213 ‘ ElseIf jyjdInt = 2 Then 214 ‘ If age < 12 Or age > 15 Then 215 ‘ errorMsg = "第" & rowIndex & "行的数据项: 该初中学生的年龄不在12岁到15岁之间,请检查!" 216 ‘ writeLog (errorMsg) 217 ‘ End If 218 ‘ Else 219 ‘ If age < 16 Or age > 18 Then 220 ‘ errorMsg = "第" & rowIndex & "行的数据项: 该高中学生的年龄不在16岁到18岁之间,请检查!" 221 ‘ writeLog (errorMsg) 222 ‘ End If 223 ‘ End If 224 End If 225 End If 226 End If 227 End If 228 End Function 229 ‘‘17 入学年月 230 Function checkRxny(valueCol As TypeValueColum, rowIndex) 231 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 232 isBeing = CheckValueLength(valueCol, rowIndex, 6, True) 233 If isBeing Then 234 isYM = CheckIsYmDate(valueCol, rowIndex) 235 End If 236 End If 237 End Function 238 ‘‘18 入学方式 239 Function checkRxfs(valueCol As TypeValueColum, rowIndex) 240 If valueCol.dicColumnIndex = 0 Then 241 MsgBox ("入学方式没有对应字典列检查,请联系管理员!") 242 Exit Function 243 End If 244 245 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 246 isBeing = DoDicCheck(valueCol, rowIndex) 247 End If 248 End Function 249 ‘‘19 就读方式 250 Function checkJdfs(valueCol As TypeValueColum, rowIndex) 251 If valueCol.dicColumnIndex = 0 Then 252 MsgBox ("就读方式没有对应字典列检查,请联系管理员!") 253 Exit Function 254 End If 255 256 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 257 isBeing = DoDicCheck(valueCol, rowIndex) 258 End If 259 End Function 260 ‘‘20 现住址 261 Function checkXzz(valueCol As TypeValueColum, rowIndex) 262 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 263 isBeing = CheckValueLength(valueCol, rowIndex, 60, False) 264 End If 265 End Function 266 ‘‘21 通信地址 267 Function checkTxfs(valueCol As TypeValueColum, rowIndex) 268 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 269 isBeing = CheckValueLength(valueCol, rowIndex, 60, False) 270 End If 271 End Function 272 ‘‘22 家庭地址 273 Function checkJtzz(valueCol As TypeValueColum, rowIndex) 274 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 275 isBeing = CheckValueLength(valueCol, rowIndex, 60, False) 276 End If 277 End Function 278 ‘‘23 联系电话 279 Function checkLxdh(valueCol As TypeValueColum, rowIndex) 280 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 281 isBeing = CheckValueLength(valueCol, rowIndex, 30, False) 282 If isBeing Then 283 IsNumber = checkBeNumeric(valueCol, rowIndex) 284 End If 285 End If 286 End Function 287 ‘‘24 邮政编码 288 Function checkYzbm(valueCol As TypeValueColum, rowIndex) 289 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 290 isBeing = CheckValueLength(valueCol, rowIndex, 6, True) 291 If isBeing Then 292 IsNumber = checkBeNumeric(valueCol, rowIndex) 293 End If 294 End If 295 End Function 296 ‘‘25 是否独生子女 297 Function checkSfdszn(valueCol As TypeValueColum, rowIndex) 298 If valueCol.dicColumnIndex = 0 Then 299 MsgBox ("是否没有对应字典列检查,请联系管理员!") 300 Exit Function 301 End If 302 303 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 304 isBeing = DoDicCheck(valueCol, rowIndex) 305 End If 306 307 End Function 308 ‘‘26 是否受过学前教育 309 Function checkSfsgxqjy(valueCol As TypeValueColum, rowIndex) 310 If valueCol.dicColumnIndex = 0 Then 311 MsgBox ("是否没有对应字典列检查,请联系管理员!") 312 Exit Function 313 End If 314 315 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 316 isBeing = DoDicCheck(valueCol, rowIndex) 317 End If 318 319 End Function 320 ‘‘27 是否留守儿童 321 Function checkSflset(valueCol As TypeValueColum, rowIndex) 322 If valueCol.dicColumnIndex = 0 Then 323 MsgBox ("是否没有对应字典列检查,请联系管理员!") 324 Exit Function 325 End If 326 327 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 328 isBeing = DoDicCheck(valueCol, rowIndex) 329 End If 330 End Function 331 ‘‘28 是否需要申请资助 332 Function checkSfsqzz(valueCol As TypeValueColum, rowIndex) 333 If valueCol.dicColumnIndex = 0 Then 334 MsgBox ("是否没有对应字典列检查,请联系管理员!") 335 Exit Function 336 End If 337 338 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 339 isBeing = DoDicCheck(valueCol, rowIndex) 340 End If 341 342 End Function 343 ‘‘29 是否享受一补 344 Function checkSfxsyb(valueCol As TypeValueColum, rowIndex) 345 If valueCol.dicColumnIndex = 0 Then 346 MsgBox ("是否没有对应字典列检查,请联系管理员!") 347 Exit Function 348 End If 349 350 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 351 isBeing = DoDicCheck(valueCol, rowIndex) 352 End If 353 354 End Function 355 ‘‘30 是否孤儿 356 Function checkSfge(valueCol As TypeValueColum, rowIndex) 357 If valueCol.dicColumnIndex = 0 Then 358 MsgBox ("是否没有对应字典列检查,请联系管理员!") 359 Exit Function 360 End If 361 362 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 363 isBeing = DoDicCheck(valueCol, rowIndex) 364 End If 365 366 End Function 367 ‘‘31 是否烈士或优抚子女 368 Function checkSflshyfzn(valueCol As TypeValueColum, rowIndex) 369 If valueCol.dicColumnIndex = 0 Then 370 MsgBox ("是否没有对应字典列检查,请联系管理员!") 371 Exit Function 372 End If 373 374 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 375 isBeing = DoDicCheck(valueCol, rowIndex) 376 End If 377 378 End Function 379 ‘‘32 上下学距离 380 Function checkSxjl(valueCol As TypeValueColum, rowIndex) 381 Dim doubleStr As Double 382 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 383 If value <> "" Then 384 If IsNumeric(value) Then 385 If value <= 0 Then 386 errorMsg = "第" & rowIndex & "行的数据项:" & valueCol.columnName & "为4位以内的正数且保留1位小数,请填写!" 387 writeLog (errorMsg) 388 Exit Function 389 ElseIf value - Fix(value) = 0 And value > 0 Then 390 value = Format(Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex), "0.0") 391 Else 392 value = Round(value, 1) 393 End If 394 Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex).value = value 395 byteLen = checkByteLength(value) 396 If byteLen > 6 Then 397 errorMsg = "第" & rowIndex & "行的数据项:" & valueCol.columnName & "为4位以内的正数且保留1位小数,请填写!" 398 writeLog (errorMsg) 399 End If 400 Else 401 errorMsg = "第" & rowIndex & "行的数据项:" & valueCol.columnName & "的内容必须为数字,请重新填写!" 402 writeLog (errorMsg) 403 End If 404 End If 405 End Function 406 ‘‘33 上下学方式 407 Function checkSxxfs(valueCol As TypeValueColum, rowIndex) 408 If valueCol.dicColumnIndex = 0 Then 409 MsgBox ("上下学方式没有对应字典列检查,请联系管理员!") 410 Exit Function 411 End If 412 413 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 414 If value <> "" Then 415 isBeing = DoDicCheck(valueCol, rowIndex) 416 End If 417 End Function 418 ‘‘34 是否需要乘坐校车 419 Function checkSfxyczxc(valueCol As TypeValueColum, rowIndex) 420 If valueCol.dicColumnIndex = 0 Then 421 MsgBox ("是否没有对应字典列检查,请联系管理员!") 422 Exit Function 423 End If 424 425 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 426 If value <> "" Then 427 isBeing = DoDicCheck(valueCol, rowIndex) 428 End If 429 430 End Function 431 ‘‘35 曾用名 432 Function checkCym(valueCol As TypeValueColum, rowIndex) 433 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 434 If value <> "" Then 435 isBeing = CheckValueLength(valueCol, rowIndex, 30, False) 436 End If 437 End Function 438 ‘‘36 身份证有效期 439 Function checkSfzyxq(valueCol As TypeValueColum, rowIndex) 440 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 441 If value <> "" Then 442 beLen = CheckValueLength(valueCol, rowIndex, 17, True) 443 If beLen Then 444 leftStr = Left(value, 8) 445 If CheckBeDate(leftStr) Then 446 Else 447 errorMsg = "第" & rowIndex & "行的数据项:" & valueCol.columnName & "不符合规范,请检查(例如:19900101-20090101)!" 448 writeLog (errorMsg) 449 Exit Function 450 End If 451 midStr = Mid(value, 9, 1) 452 If midStr <> "-" Then 453 errorMsg = "第" & rowIndex & "行的数据项:" & valueCol.columnName & "不符合规范,请检查(例如:19900101-20090101,其中‘-‘为英文横杠)!" 454 writeLog (errorMsg) 455 Exit Function 456 End If 457 rightStr = Right(value, 8) 458 If CheckBeDate(rightStr) Then 459 Else 460 errorMsg = "第" & rowIndex & "行的数据项:" & valueCol.columnName & "不符合规范,请检查(例如:19900101-20090101)!" 461 writeLog (errorMsg) 462 Exit Function 463 End If 464 compareNumber = compareDate(leftStr, rightStr) 465 If compareNumber <> -1 Then 466 errorMsg = "第" & rowIndex & "行的数据项:" & valueCol.columnName & "不合法,请检查(例如:19900101-20090101且后面的日期要大于前面的日期)!" 467 writeLog (errorMsg) 468 Exit Function 469 End If 470 Else 471 errorMsg = "第" & rowIndex & "行的数据项:" & valueCol.columnName & "不符合规范,请检查(例如:19900101-20090101)!" 472 writeLog (errorMsg) 473 End If 474 End If 475 End Function 476 ‘‘37 血型 477 Function checkXx(valueCol As TypeValueColum, rowIndex) 478 If valueCol.dicColumnIndex = 0 Then 479 MsgBox ("血型没有对应字典列检查,请联系管理员!") 480 Exit Function 481 End If 482 483 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 484 If value <> "" Then 485 isBeing = DoDicCheck(valueCol, rowIndex) 486 End If 487 End Function 488 ‘‘38 特长 489 Function checkTc(valueCol As TypeValueColum, rowIndex) 490 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 491 If value <> "" Then 492 isBeing = CheckValueLength(valueCol, rowIndex, 60, False) 493 End If 494 End Function 495 ‘‘39 学籍辅号 496 Function checkXjfh(valueCol As TypeValueColum, rowIndex) 497 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 498 If value <> "" Then 499 isBeing = CheckValueLength(valueCol, rowIndex, 20, False) 500 If isBeing Then 501 IsNumber = checkBeNumeric(valueCol, rowIndex) 502 End If 503 End If 504 End Function 505 ‘‘40 班内学号 506 Function checkBnxh(valueCol As TypeValueColum, rowIndex) 507 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 508 If value <> "" Then 509 isBeing = CheckValueLength(valueCol, rowIndex, 20, False) 510 If isBeing Then 511 IsNumber = checkBeNumeric(valueCol, rowIndex) 512 End If 513 End If 514 End Function 515 ‘‘41 学生来源 516 Function checkXsly(valueCol As TypeValueColum, rowIndex) 517 If valueCol.dicColumnIndex = 0 Then 518 MsgBox ("学生来源没有对应字典列检查,请联系管理员!") 519 Exit Function 520 End If 521 522 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 523 If value <> "" Then 524 isBeing = DoDicCheck(valueCol, rowIndex) 525 End If 526 End Function 527 ‘‘42 电子信箱 528 Function checkDzxx(valueCol As TypeValueColum, rowIndex) 529 dzxxStr = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 530 If dzxxStr = "" Then 531 Exit Function 532 Else 533 isBeing = CheckValueLength(valueCol, rowIndex, 30, False) 534 If isBeing Then 535 isEmail = matchEmail(dzxxStr) 536 If isEmail Then 537 Else 538 errorMsg = "第" & rowIndex & "行的数据项:" & valueCol.columnName & "格式不合法,请检查(例如:zxxs@163.com)!" 539 writeLog (errorMsg) 540 End If 541 End If 542 End If 543 End Function 544 ‘‘43 主页地址 545 Function checkZydz(valueCol As TypeValueColum, rowIndex) 546 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 547 If value <> "" Then 548 isBeing = CheckValueLength(valueCol, rowIndex, 60, False) 549 End If 550 End Function 551 ‘‘44 残疾类型 552 Function checkCjlx(valueCol As TypeValueColum, rowIndex) 553 If valueCol.dicColumnIndex = 0 Then 554 MsgBox ("残疾类型没有对应字典列检查,请联系管理员!") 555 Exit Function 556 End If 557 558 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 559 If value <> "" Then 560 isBeing = DoDicCheck(valueCol, rowIndex) 561 End If 562 End Function 563 ‘‘45 是否由政府购买学位 564 Function checkSfyzfgmxw(valueCol As TypeValueColum, rowIndex) 565 If valueCol.dicColumnIndex = 0 Then 566 MsgBox ("是否没有对应字典列检查,请联系管理员!") 567 Exit Function 568 End If 569 570 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 571 If value <> "" Then 572 isBeing = DoDicCheck(valueCol, rowIndex) 573 End If 574 575 End Function 576 ‘‘46 是否随迁子女 577 Function checkSfsqzn(valueCol As TypeValueColum, rowIndex) 578 If valueCol.dicColumnIndex = 0 Then 579 MsgBox ("是否没有对应字典列检查,请联系管理员!") 580 Exit Function 581 End If 582 583 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 584 isBeing = DoDicCheck(valueCol, rowIndex) 585 End If 586 End Function 587 ‘‘47 成员1姓名 588 Function checkCyyxm(valueCol As TypeValueColum, rowIndex) 589 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 590 oldValue = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 591 newValue = Replace(oldValue, " ", "") 592 Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex).value = newValue 593 isBeing = CheckValueLength(valueCol, rowIndex, 30, False) 594 End If 595 End Function 596 ‘‘48 成员1关系 597 Function checkCyygx(valueCol As TypeValueColum, rowIndex) 598 If valueCol.dicColumnIndex = 0 Then 599 MsgBox ("关系没有对应字典列检查,请联系管理员!") 600 Exit Function 601 End If 602 603 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 604 isBeing = DoDicCheck(valueCol, rowIndex) 605 End If 606 End Function 607 ‘‘49 成员1关系说明 608 Function checkCyygxsm(valueCol As TypeValueColum, rowIndex) 609 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 610 If value <> "" Then 611 isBeing = CheckValueLength(valueCol, rowIndex, 20, False) 612 End If 613 End Function 614 ‘‘50 成员1现住址 615 Function checkCyyxzz(valueCol As TypeValueColum, rowIndex) 616 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 617 isBeing = CheckValueLength(valueCol, rowIndex, 60, False) 618 End If 619 End Function 620 ‘‘51 成员1户口所在地行政区划 621 Function checkCyyhkszdxzqh(valueCol As TypeValueColum, rowIndex) 622 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 623 isBeing = CheckValueLength(valueCol, rowIndex, 12, True) 624 If isBeing Then 625 IsNumber = checkBeNumeric(valueCol, rowIndex) 626 End If 627 End If 628 End Function 629 ‘‘52 成员1联系电话 630 Function checkCyylxdh(valueCol As TypeValueColum, rowIndex) 631 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 632 isBeing = CheckValueLength(valueCol, rowIndex, 30, False) 633 If isBeing Then 634 IsNumber = checkBeNumeric(valueCol, rowIndex) 635 End If 636 End If 637 End Function 638 ‘‘53 成员1是否监护人 639 Function checkCyysfjhr(valueCol As TypeValueColum, rowIndex) 640 If valueCol.dicColumnIndex = 0 Then 641 MsgBox ("是否没有对应字典列检查,请联系管理员!") 642 Exit Function 643 End If 644 645 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 646 isBeing = DoDicCheck(valueCol, rowIndex) 647 End If 648 End Function 649 ‘‘54 成员1身份证件类型 650 Function checkCyysfzjlx(valueCol As TypeValueColum, rowIndex) 651 If valueCol.dicColumnIndex = 0 Then 652 MsgBox ("身份证件类型没有对应字典列检查,请联系管理员!") 653 Exit Function 654 End If 655 656 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 657 isBeing = DoDicCheck(valueCol, rowIndex) 658 End If 659 End Function 660 ‘‘55 成员1身份证件号 661 Function checkCyysfzjh(valueCol As TypeValueColum, rowIndex) 662 sfzjlxStr = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex - 1) 663 ‘‘If IsEmpty(sfzjlxStr) Then 664 ‘‘Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex - 1).value = "其他" 665 ‘‘Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex).value = "" 666 ‘‘Else 667 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex).value 668 If value = "" And sfzjlxStr <> "其他" And sfzjlxStr <> "" Then 669 errorMsg = "第" & rowIndex & "行的数据项:成员1身份证件号不能为空,请检查!" 670 writeLog (errorMsg) 671 Exit Function 672 End If 673 If sfzjlxStr = "其他" Then 674 Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex).value = "" 675 ElseIf sfzjlxStr = "居民身份证" Then 676 beID = IDcheck(Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex)) 677 If beID = 0 Then 678 errorMsg = "第" & rowIndex & "行的数据项:成员1身份证件号不正确,请检查!" 679 writeLog (errorMsg) 680 ElseIf beID = 1 Then 681 Else 682 Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex).value = beID 683 End If 684 Else 685 byteLen = checkByteLength(Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex)) 686 If byteLen > 18 Then 687 errorMsg = "第" & rowIndex & "行的数据项:成员1身份证件号长度不能大于18个字符,请检查!" 688 writeLog (errorMsg) 689 End If 690 End If 691 692 End Function 693 ‘‘56 成员1民族 694 Function checkCyymz(valueCol As TypeValueColum, rowIndex) 695 If valueCol.dicColumnIndex = 0 Then 696 MsgBox ("民族没有对应字典列检查,请联系管理员!") 697 Exit Function 698 End If 699 700 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 701 If value <> "" Then 702 isBeing = DoDicCheck(valueCol, rowIndex) 703 End If 704 End Function 705 ‘‘57 成员1工作单位 706 Function checkCyygzdw(valueCol As TypeValueColum, rowIndex) 707 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 708 If value <> "" Then 709 isBeing = CheckValueLength(valueCol, rowIndex, 20, False) 710 End If 711 End Function 712 ‘‘58 成员1职务 713 Function checkCyyzw(valueCol As TypeValueColum, rowIndex) 714 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 715 If value <> "" Then 716 isBeing = CheckValueLength(valueCol, rowIndex, 20, False) 717 End If 718 End Function 719 ‘‘59 成员2姓名 720 Function checkCyexm(valueCol As TypeValueColum, rowIndex) 721 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 722 If value <> "" Then 723 oldValue = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 724 newValue = Replace(oldValue, " ", "") 725 Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex).value = newValue 726 If newValue <> "" Then 727 isBeing = CheckValueLength(valueCol, rowIndex, 30, False) 728 End If 729 End If 730 End Function 731 ‘‘60 成员2关系 732 Function checkCyegx(valueCol As TypeValueColum, rowIndex) 733 If valueCol.dicColumnIndex = 0 Then 734 MsgBox ("关系没有对应字典列检查,请联系管理员!") 735 Exit Function 736 End If 737 738 xmColumnIndx = valueCol.columnIndex - 1 739 value = Sheets(valueSheetName).Cells(rowIndex, xmColumnIndx) ‘成员2姓名是否填写 740 If value = "" Then 741 Exit Function 742 End If 743 744 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 745 isBeing = DoDicCheck(valueCol, rowIndex) 746 End If 747 End Function 748 ‘‘61 成员2关系说明 749 Function checkCyegxsm(valueCol As TypeValueColum, rowIndex) 750 xmColumnIndx = valueCol.columnIndex - 2 751 value = Sheets(valueSheetName).Cells(rowIndex, xmColumnIndx) ‘成员2姓名是否填写 752 If value = "" Then 753 Exit Function 754 End If 755 756 gxsmValue = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 757 If gxsmValue <> "" Then 758 isBeing = CheckValueLength(valueCol, rowIndex, 20, False) 759 End If 760 761 End Function 762 ‘‘62 成员2现住址 763 Function checkCyexzz(valueCol As TypeValueColum, rowIndex) 764 xmColumnIndx = valueCol.columnIndex - 3 765 value = Sheets(valueSheetName).Cells(rowIndex, xmColumnIndx) ‘成员2姓名是否填写 766 If value = "" Then 767 Exit Function 768 End If 769 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 770 isBeing = CheckValueLength(valueCol, rowIndex, 60, False) 771 End If 772 773 End Function 774 ‘‘63 成员2户口所在地行政区划 775 Function checkCyehkszdxzqh(valueCol As TypeValueColum, rowIndex) 776 xmColumnIndx = valueCol.columnIndex - 4 777 value = Sheets(valueSheetName).Cells(rowIndex, xmColumnIndx) ‘成员2姓名是否填写 778 If value = "" Then 779 Exit Function 780 End If 781 782 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 783 isBeing = CheckValueLength(valueCol, rowIndex, 12, True) 784 If isBeing Then 785 IsNumber = checkBeNumeric(valueCol, rowIndex) 786 End If 787 End If 788 789 End Function 790 ‘‘64 成员2联系电话 791 Function checkCyelxdh(valueCol As TypeValueColum, rowIndex) 792 xmColumnIndx = valueCol.columnIndex - 5 793 value = Sheets(valueSheetName).Cells(rowIndex, xmColumnIndx) ‘成员2姓名是否填写 794 If value = "" Then 795 Exit Function 796 End If 797 798 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 799 isBeing = CheckValueLength(valueCol, rowIndex, 30, False) 800 If isBeing Then 801 IsNumber = checkBeNumeric(valueCol, rowIndex) 802 End If 803 End If 804 805 End Function 806 ‘‘65 成员2是否监护人 807 Function checkCyesfjhr(valueCol As TypeValueColum, rowIndex) 808 If valueCol.dicColumnIndex = 0 Then 809 MsgBox ("是否没有对应字典列检查,请联系管理员!") 810 Exit Function 811 End If 812 813 xmColumnIndx = valueCol.columnIndex - 6 814 value = Sheets(valueSheetName).Cells(rowIndex, xmColumnIndx) ‘成员2姓名是否填写 815 If value = "" Then 816 Exit Function 817 End If 818 819 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 820 isBeing = DoDicCheck(valueCol, rowIndex) 821 End If 822 823 End Function 824 ‘‘66 成员2身份证件类型 825 Function checkCyesfzjlx(valueCol As TypeValueColum, rowIndex) 826 If valueCol.dicColumnIndex = 0 Then 827 MsgBox ("身份证件类型没有对应字典列检查,请联系管理员!") 828 Exit Function 829 End If 830 831 xmColumnIndx = valueCol.columnIndex - 7 832 value = Sheets(valueSheetName).Cells(rowIndex, xmColumnIndx) ‘成员2姓名是否填写 833 If value = "" Then 834 Exit Function 835 End If 836 837 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 838 isBeing = DoDicCheck(valueCol, rowIndex) 839 End If 840 End Function 841 ‘‘67 成员2身份证件号 842 Function checkCyesfzjh(valueCol As TypeValueColum, rowIndex) 843 sfzjlxStr = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex - 1) 844 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex).value 845 If value = "" And sfzjlxStr <> "其他" And sfzjlxStr <> "" Then 846 errorMsg = "第" & rowIndex & "行的数据项:成员2身份证件号不能为空,请检查!" 847 writeLog (errorMsg) 848 Exit Function 849 End If 850 If sfzjlxStr = "其他" Then 851 Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex).value = "" 852 ElseIf sfzjlxStr = "居民身份证" Then 853 beID = IDcheck(Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex)) 854 If beID = 0 Then 855 errorMsg = "第" & rowIndex & "行的数据项:成员2身份证件号不正确,请检查!" 856 writeLog (errorMsg) 857 ElseIf beID = 1 Then 858 Else 859 Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex).value = beID 860 End If 861 Else 862 byteLen = checkByteLength(Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex)) 863 If byteLen > 18 Then 864 errorMsg = "第" & rowIndex & "行的数据项:成员2身份证件号长度不能大于18个字符,请检查!" 865 writeLog (errorMsg) 866 End If 867 End If 868 869 End Function 870 ‘‘68 成员2民族 871 Function checkCyemz(valueCol As TypeValueColum, rowIndex) 872 If valueCol.dicColumnIndex = 0 Then 873 MsgBox ("民族没有对应字典列检查,请联系管理员!") 874 Exit Function 875 End If 876 877 xmColumnIndx = valueCol.columnIndex - 9 878 value = Sheets(valueSheetName).Cells(rowIndex, xmColumnIndx) ‘成员2姓名是否填写 879 If value = "" Then 880 Exit Function 881 End If 882 883 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 884 If value <> "" Then 885 isBeing = DoDicCheck(valueCol, rowIndex) 886 End If 887 End Function 888 ‘‘69 成员2工作单位 889 Function checkCyegzdw(valueCol As TypeValueColum, rowIndex) 890 xmColumnIndx = valueCol.columnIndex - 10 891 value = Sheets(valueSheetName).Cells(rowIndex, xmColumnIndx) ‘成员2姓名是否填写 892 If value = "" Then 893 Exit Function 894 End If 895 896 gzdwValue = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 897 If gzdwValue <> "" Then 898 isBeing = CheckValueLength(valueCol, rowIndex, 20, False) 899 End If 900 End Function 901 ‘‘70 成员2职务 902 Function checkCyezw(valueCol As TypeValueColum, rowIndex) 903 xmColumnIndx = valueCol.columnIndex - 11 904 value = Sheets(valueSheetName).Cells(rowIndex, xmColumnIndx) ‘成员2姓名是否填写 905 If value = "" Then 906 Exit Function 907 End If 908 909 zwValue = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 910 If zwValue <> "" Then 911 isBeing = CheckValueLength(valueCol, rowIndex, 20, False) 912 End If 913 End Function 914 ‘‘71 是否进城务工人员随迁子女 915 Function checkSfjcwgrysqzn(valueCol As TypeValueColum, rowIndex) 916 If valueCol.dicColumnIndex = 0 Then 917 MsgBox ("是否没有对应字典列检查,请联系管理员!") 918 Exit Function 919 End If 920 921 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 922 isBeing = DoDicCheck(valueCol, rowIndex) 923 End If 924 925 If isBeing Then 926 sfsqznColumnIndx = valueCol.columnIndex + 3 927 sfsqznValue = Sheets(valueSheetName).Cells(rowIndex, sfsqznColumnIndx) ‘是否随迁子女 928 929 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 930 If value = "是" And sfsqznValue = "否" Then 931 errorMsg = "第" & rowIndex & "行的数据项:是否进城务工人员随迁子女选择是,是否随迁子女请选择是!" 932 writeLog (errorMsg) 933 End If 934 End If 935 End Function 936 ‘‘72 是否农村留守儿童 937 Function checkSfnclset(valueCol As TypeValueColum, rowIndex) 938 If valueCol.dicColumnIndex = 0 Then 939 MsgBox ("是否没有对应字典列检查,请联系管理员!") 940 Exit Function 941 End If 942 943 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 944 isBeing = DoDicCheck(valueCol, rowIndex) 945 End If 946 947 If isBeing Then 948 sflsetColumnIndx = valueCol.columnIndex - 3 949 sflsetValue = Sheets(valueSheetName).Cells(rowIndex, sflsetColumnIndx) ‘是否留守儿童 950 951 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 952 If value = "是" And sflsetValue = "否" Then 953 errorMsg = "第" & rowIndex & "行的数据项:是否农村留守儿童选择是,是否留守儿童请选择是!" 954 writeLog (errorMsg) 955 End If 956 End If 957 End Function 958 ‘‘73 是否残疾人 959 Function checkSfcjr(valueCol As TypeValueColum, rowIndex) 960 If valueCol.dicColumnIndex = 0 Then 961 MsgBox ("是否没有对应字典列检查,请联系管理员!") 962 Exit Function 963 End If 964 965 If checkRequired(rowIndex, valueCol.columnIndex) = 1 Then 966 isBeing = DoDicCheck(valueCol, rowIndex) 967 End If 968 End Function 969 ‘‘74 校区号 970 Function checkXqh(valueCol As TypeValueColum, rowIndex) 971 value = Sheets(valueSheetName).Cells(rowIndex, valueCol.columnIndex) 972 If value <> "" Then 973 isBeing = CheckValueLength(valueCol, rowIndex, 20, False) 974 End If 975 End Function
以上是关于校验函数的主要内容,如果未能解决你的问题,请参考以下文章