如何删除不包含#N / A

时间:2019-11-05 21:05:04

标签: excel vba

我对vlookup具有自动填充功能,我想删除/删除E列中不是#N / A的所有行(我只希望保留产生错误的行)

我有一个相反的代码,并删除包含CONTAIN#N / A的所有行,但我需要相反的

On Error Resume Next
Columns("E").SpecialCells(xlFormulas, xlErrors).EntireRow.Delete

1 个答案:

答案 0 :(得分:0)

您可以使用 xlTextValues xlNumbers 来代替“ xlErrors” 像这样:

<!-- Assign Role To User -->
<div class="modal fade" id="assignrole" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <form>
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="myModalLabel">Assign Role To User</h4>
        </div>
        <div class="modal-body">
          <div class="form-group">
            <label for="selectuser">Select User</label>
            <select class="form-control" id="selectuser">
              <?php foreach ($users as $user): ?>
              <option value="<?= $user['id'] ?>">
                <?= $user['username'] ?>
              </option>
              <?php endforeach; ?>
            </select>
          </div>
          <div class="form-group">
            <label for="selectrole">Select Role</label>
            <select class="form-control" id="selectrole" data-live-search="false">
              <?php foreach ($roles as $role): ?>
              <option value="<?= $role['id'] ?>">
                <?= $role['role_name'] ?>
              </option>
              <?php endforeach; ?>
            </select>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
          <button type="submit" id="assignrole" class="btn btn-primary">Save changes</button>
        </div>
      </form>
    </div>
  </div>
</div>

$(document).ready(function() {

  var base_url = "http://127.0.0.1/ci3/";

  $("#assignrole").on('click', function() {
    var user_id = $('#selectuser option:selected').attr('value');
    var role_id = $('#selectrole option:selected').attr('value');

    $.ajax({
      url: base_url + "backend/assign_role",
      method: 'POST',
      data: {
        "user_id": user_id,
        "role_id": role_id
      },
      dataType: 'json',
      success: function(data) {
        if (data.status == 1) {
          alert("Data Send Success");
        }
      },
      error: function(data) {
        alert("maybe your login session timed out, try to login again!");
      }
    });
  });
});