excel vba的**應該怎麼寫?
1樓:陽光上的橋
除錯通過的**如下:
<>option explicit
sub x()
dim arrb, arrj, n&, i&, j&, cnt&, x&, t, arr
n = cells(, "j").end(xlup).row 'j列最後一行。
arrb = range("b1:e1")
arrj = range("j1:j" &n)
if instr(arrj(n, 1), 0 then n = n - 1 '如果j列最後一會沒有等號就去掉。
cnt = 0 '滿足條件的行數。
for i = 1 to n
arr = split(arrj(i, 1), arr(0)值表,arr(1)計數。
x = 0 '存在值的個數。
for each t in split(arr(0),for j = 1 to ubound(arrb, 2)
if arrb(1, j) -t = 0 then x = x + 1
next j
next t
if arr(1) -x = 0 then cnt = cnt + 1
next i
cells(n + 1, "j") cnt
end sub
2樓:網友
逗號都是英文的麼?
用**的自定義函式。
excel vba這個**怎麼寫的?
3樓:陽光上的橋
示例資料:<>
程式**:<>
程式文字:option explicit
sub 巨集1()
dim arrc%()arrg, n&, i&, j&, s$n = cells(, "g").end(xlup).row - 8 'g列從9行開始的行數。
redim arrc%(1 to n, 1 to 1)arrg = range("g9").resize(n, 8)for i = 1 to n
s = for j = 1 to ubound(arrg, 2)s = s & iif(arrg(i, j) >0, "1", 0")
next j
arrc(i, 1) =maxn(s)
next i
range("c9").resize(n, 1) =arrcend sub
function maxn(s$) as integerdim arr, i&, n&
arr = split(s, "0")
for i = lbound(arr) to ubound(arr)if len(arr(i)) n then n = len(arr(i))
next i
maxn = n
end function
請教高手關於ecel中的vba使用者窗體的兩個問題
呃,舉個例子好了 1 在名為 textbox1 的文字框內輸入資料,點選 名為commandbutton1 的按鈕 後把輸入的資料賦值給a1單元格 private sub commandbutton1 click range a1 textbox1.textend sub 當然 你也可以用textb...
vb中WITH的用法,VBA中的WITH 語句用法 及含義
看看msdn上怎麼解釋的.with 語句 在一個單一物件或一個使用者定義型別上執行一系列的語句。語法with object statements end with with 語句的語法具有以下幾個部分 部分 描述 object 必要引數。一個物件或使用者自定義型別的名稱。statements 可選引...
關於struct list的寫法
首先,你的第二種在c中是不正確的.其它兩種正確.c中還有一種就是沒有結構名的.如 struct student 這是在只使用一次這樣的結構體時才用的.如果後面還要使用這個結構的話,你必須得重寫整個結構說明部分.你的第一種寫法,是把結構說明和結構變數student的定義分開的.這個最常用,如果後面你還...