1
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 5 years have passed since last update.

VBAメモ 整数部「10の位」「100の位」で設定された丸め位置

Posted at

StrReverse
文字列の並びを逆さにする。

丸めの桁位置を指定するのに応用。

Round(値,★桁数)

1の位 → -1
10の位 → -2
100の位 → -3

設定値 = "100"
桁数 = Instr(StrReverse(strVal),"1",1,vbBinaryCompare)*-1
※ベタ打ちだから、ミスってるかも。

1)StrReserveで「100」が「001」
2)Instrで「001」の「1」の文字位置を取得
(この場合、「3」が戻り値)
3)整数部なので「-1」を掛ける

1
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
1
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?