VBA程式設計實現,VBA 程式設計實現

2022-07-06 14:42:13 字數 1244 閱讀 2742

1樓:表裡如一

按alt+f11,雙擊sheet1,複製下列**,執行即可:

sub aa()

dim i%, c as range

i = 1

with activesheet

'迴圈sheet1中第一行(標題行)中所有有資料的文字,如果=「aaa」,"bbb","ccc"."ddd","ffff","zzzz",就按順序將這一列複製到sheet2

for each c in .range(.cells(1, 1), .

cells(1, .cells(1, .columns.

count).end(xltoleft).column))

if c.value = "aaa" then

.columns(c.column).copy sheet2.cells(1, i)

i = i + 1

end if

if c.value = "bbb" then

.columns(c.column).copy sheet2.cells(1, i)

i = i + 1

end if

if c.value = "ccc" then

.columns(c.column).copy sheet2.cells(1, i)

i = i + 1

end if

if c.value = "ddd" then

.columns(c.column).copy sheet2.cells(1, i)

i = i + 1

end if

if c.value = "ffff" then

.columns(c.column).copy sheet2.cells(1, i)

i = i + 1

end if

if c.value = "zzzz" then

.columns(c.column).copy sheet2.cells(1, i)

i = i + 1

end if

next

end with

end sub

2樓:姓王的

有列名為「zzzz」的表嗎?最大列名為「xfd」

vba程式設計實現:1!+2!+3!+......+n!

3樓:

這是實現計算過程的函式,在需要的地方呼叫即可。

EXCEL如何用公式或VBA實現自動算出可用庫存

如下,詳見附件 private sub commandbutton1 click for i 2 to a65536 end 3 row if cells i,1 cells i 1,1 then cells i,5 cells i 1,6 if cells i,5 0 then cells i,5...

用vb程式設計序實現

隨機數重複的做法 把text1 text3的multiline屬性設定為true dim a 100 as integerprivate sub command1 click k 1 if text2.text then exit subfor i 1 to 100 if a i text2.tex...

android程式設計中如何實現activity

在eclipse中線新建專案,再新建包,最後就可以新建activity,其實就是新建一個class,只不過是繼承至activity android studio怎樣新建activity android studio怎麼建立一個activity檔案 android studio怎樣新建activity...