VBA中下面怎麼錯了

2022-09-04 11:40:31 字數 799 閱讀 6514

1樓:

dim a as string

a = range("a" & i)

你的**錯誤百出,根本無法執行。

dim a as string

dim i as integer

dim j as integer

for i = 2 to 281

a = range("a" & i)

for j = 2 to 281

if n = range("m" & j) thenrange("n" & i &"," &" p" & j).select

selection.copy

sheets("sheet2").selectrange("b" & i & "," & "d" & i).select

activesheet.paste

end if

next

next i

2樓:匿名使用者

針對第五行錯誤,說明如下

dim a as integer

既然定義a為一個integer型別的變數,就不能等於一個range,a = range("a"&i)

將dim a as integer 換成dim a as ranges試試

3樓:匿名使用者

a = range("ai"),計算機理解的是:將名為「ai」的range中的值賦給c,但是你的excel中並沒有名叫"ai"的range。你的原意是讓a列第i行格中的值賦給a,正確的寫法是a = range("a" & i)。

linux中下面rmdir用法應該如何解釋

rmdir是常用的命令,該命令的功能是刪除空目錄,一個目錄被刪除之前必須是空的。注意,rm r dir命令可代替rmdir,但是有很大危險性。刪除某目錄時也必須具有對父目錄的寫許可權。1 命令格式 rmdir 選項 目錄.2 命令功能 該命令從一個目錄中刪除一個或多個子目錄項,刪除某目錄時也必須具有...

雙欄排版中下面的作者簡介怎樣能加在下面,並只在左邊一欄

插入 分隔符 分欄符或換行符。試一試。祝你成功!1 使用文字框插入比較方便。2 也可以把作者簡介貼上到第一面左欄下方相應位置,前面用橫線與正文隔開。其後面的正文自然會順延至右欄上分。在標題欄找到 插入 引用 題注 會看到一個相應的視窗,那裡可以根據自己需要自由選擇一些設定,就可以加上作者簡介。我覺得...

excel換成VBA怎麼實現

在查詢工作表中 for i 1 to a65536 end xlup row set c sheet2.range a1 a65536 find cells i,1 1 if not c is nothing thencells i,2 c.offset 1 next i sub cx dim r1...