電腦筆記

2020年10月8日 星期四

VBA - find out variable position in array.

 

Use Application.Match


Example: 

Dim pos, arr, val

arr=Array(1,2,4,5)
val = 4
pos=Application.Match(val, arr, False)

if not iserror(pos) then
   Msgbox val & " is at position " & pos
else
   Msgbox val & " not found!"
end if
張貼者: Bunny 於 晚上10:04 沒有留言:
以電子郵件傳送這篇文章BlogThis!分享至 X分享至 Facebook分享到 Pinterest
標籤: Excel, vba
較新的文章 較舊的文章 首頁
訂閱: 文章 (Atom)

關於我自己

Bunny
檢視我的完整簡介

網誌存檔

  • ►  2021 (4)
    • ►  8月 (1)
    • ►  7月 (1)
    • ►  6月 (1)
    • ►  3月 (1)
  • ▼  2020 (20)
    • ►  11月 (1)
    • ▼  10月 (1)
      • VBA - find out variable position in array.
    • ►  9月 (1)
    • ►  8月 (5)
    • ►  6月 (2)
    • ►  5月 (7)
    • ►  4月 (1)
    • ►  2月 (2)
  • ►  2019 (22)
    • ►  12月 (1)
    • ►  11月 (2)
    • ►  9月 (2)
    • ►  8月 (4)
    • ►  7月 (3)
    • ►  6月 (3)
    • ►  5月 (5)
    • ►  4月 (2)
頂尖企業主題. 技術提供:Blogger.