VBA type mismatch array and cell .

Updated on technology 2024-08-05
5 answers
  1. Anonymous users2024-02-15

    First of all, don't know yours, 2).Whether sheets(1) in the value is written incorrectly (whether it is sheet1 or not).

    Secondly, I have tried it, and this method is possible. If you really can't do it, you can also consider using a string variable to get the value of cells(2,2) and then use the function val to convert it to integer.

  2. Anonymous users2024-02-14

    If you sheet(1).The display data in cells(2,2) is not integer, it will be wrong, because you have defined the type of the array variable as integer in **, you can remove the as integer in the first sentence, and you can use any type. Namely:

    dim datanum(4)

  3. Anonymous users2024-02-13

    ,2) if the numeric property is not integer, it will be wrong.

    Most of the time, excel can automatically convert numeric types, but I have also encountered situations where "just" does not convert for you, and I don't know why.

    So, in ,2).value with a cast function.

    is a way to avoid trouble.

    It is recommended to use cint(,2).value).

  4. Anonymous users2024-02-12

    The types in the VBA do not match, and it is possible to compare, or two different types are used in the calculation, resulting in a failure to match.

    For example, if you compare an object to a text, it won't match.

    For example, in Excel, adding a worksheet object and a numeric value will prompt a mismatch of types.

    Also, if you multiply a number by a text and do so, it will also give you an error.

    Check it out. Objects all have attributes. For example, if you want to compare whether the name of an object is the same as a text, you can use the object properties to extract the name of the object and compare it with the text.

    e.g. if ="Create a new file" then

    end if

    That's okay.

    If the object is an object, you use the following statement if object ="Create a new file" then……end if

    That's what went wrong, the type didn't match.

    It's not easy to type on your phone, if you understand, please give it a thumbs up.

  5. Anonymous users2024-02-11

    **Take a screenshot to help you find out the reason.

Related questions
13 answers2024-08-05

private sub form_load()

1 'drawwidth returns or sets the line weight for the output of the graphical method. >>>More

7 answers2024-08-05

According to the information and arrangement you provided above, enter ==vlookup(b:b, table 2!) in the cells in column d of table 1 in the worksheetb:c,2,0)

21 answers2024-08-05

aoc 210v5.22 inches. 1250.

By the way, I despise the next three stars, and the things of the stick are disgusting when you use them >>>More

11 answers2024-08-05

Poor charger contact, broken phone charging port, or socket problem. >>>More

34 answers2024-08-05

If the diamond ring and the certificate do not match, you can protect your legitimate rights and interests by following the following steps: >>>More