0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Excel VBA ロビカスと32bit日時型数列オーバーフローは救いがたい

Posted at

ロビカス

オーバーフロー

セルに##########が並ぶ
VBAで値を拾うとそこで停止する。
エラーが回避できない

https://vbabeginner.net/error-6-response-method-overflow/
エラー対応方法
エラー6の対応方法は、データ型の範囲外の値を設定しないようにするか、データ型をより範囲の広い型に変更します。
簡単なのは変数の型をVariant型もしくは型を省略(省略するとVariantと解釈される)することです。

On Error とか IsERROR関数でも回避できず止まってしまう。

日付型数列

2023 10 09 23 52 16 → 20231009235216 14桁 2147 48 36 47 Long型では2桁多い
通常はDoubleになるはずなのにDoubleにならずオーバーフローになる。

Web版と64bit Excelでは起きない

もしくはバージョンの違いか?
64bitのExcelでは起きない。
一応Double型で入る。
32bitだとオーバーフローになってしまう。

対処法

またはセルの表示形式を文字列型にする。ただし、代入したとたんオーバーフローになる。
頭にをつけて続けて数字を入力し、テキスト型にする。ただし、この場合頭の'をとる。

ドツボではまる場所と見分け方

64bitを前提にして日時型の数列をホイホイ入力していると、32bitになったとたんオーバーフローで停止する。
#####が現れたら要注意。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?