jeudi 1 mars 2018

how can I set value on if conditional statement and control it?

  Set a = ThisWorkbook.Sheets("sheet1").Range("B2:B1500").Find(What:=his1, LookIn:=xlValues)
  If Not a Is Nothing Then
   ....blah
  end if

How can I set "a" on if conditional and control?

If Not a = ThisWorkbook.Sheets("sheet1").Range("B2:B1500").Find(What:=his1, LookIn:=xlValues).set Is Nothing Then
 ....blah
 end if

Visual basic says; "Object variable or with block variable not set"

I would like to set "a" on 20 different sheets and if it find one I want to stop to control other sheets(other sheets has "a" variable too but I want to skip them). Its possible to do it with label but I dont want to do it like that;

  Set a = ThisWorkbook.Sheets("sheet1").Range("B2:B1500").Find(What:=his1, LookIn:=xlValues)
  If Not a Is Nothing Then
   ....blah
  Go to 10
  end if

because I will repeat this process for 1500 different "his1" value.

Aucun commentaire:

Enregistrer un commentaire