VBA搜索文本的可变范围

时间:2015-07-28 09:27:55

标签: excel vba excel-vba range

我想编写一个vba宏,在变量范围内搜索值“x”和“X”,如果找到其中一个值,我想隐藏该行。 我知道如何使用范围(单元格(行,列),单元格(行,列))创建范围变量,但是当我将变量范围与搜索组合时,我无法使其运行。

Sub zeilen_ausblenden()
    Dim count As Integer
    Dim maxrow As Integer

    maxrow = Worksheets("Anwendungen -> Prozesse ").UsedRange.Rows.count


    For Row = 11 To maxrow

        count = WorksheetFunction.Range("K" & Row & ":KB" & Row).Find("x", "X", LookIn:=xlValues)

        If count > 0 Then
        Else

            Rows(Row).EntireRow.Hidden = True

        End If

    Next

End Sub

1 个答案:

答案 0 :(得分:0)

试试这段代码:

;(function($) {

  var Sanbox = {
    init: function(options, elem) {
      self = this;

      // combine default options and user passing
      self.options = $.extend( {}, $.fn.sanbox.options, options );
      console.log( this );          // an instance of Sanbox() object the caller
    },
    greet: function() {
      console.log( 'work' );
    }
  };

  // create your sanbox plugin
  $.fn.sanbox = function(options) {
    return this.each(function() {
      var sanbox = Object.create(Sanbox);
      sanbox.init(options, this);
    })
  }

  // plugin default options
  $.fn.sanbox.options = {
    name : 'byer',
    age : 24,
    address : 'Lorem ipsum dolor sit amet.'
  };

})(jQuery);

// use