VBA問題求教

2022-11-30 01:15:10 字數 1532 閱讀 2537

1樓:電腦愛好者度雲

private sub worksheet_change(byval target as range)

if sheet1.range("b1").value = 2 and sheet1.range("a1").value = 1 then

sheet2.activate ' 啟用sheet2表

sheet2.range("c1").select '游標跳到shee2表的c1單元格

end if

end sub

如果你想根據sheet1中f1單元格的內容來跳轉到shee2相應該的單元格,可以用下面**:

private sub worksheet_change(byval target as range)

dim a as string

if sheet1.range("b1").value = 2 and sheet1.range("a1").value = 1 then

a = sheet1.range("f1").value

sheet2.activate ' 啟用sheet2表

sheet2.range(sheet1.range("f1")).select '游標跳到sheet1表中f相對應內容的單元格

end if

end sub

2樓:匿名使用者

1、跳至sheet2的a1

private sub worksheet_calculate()if range("b1").value = 2 and range("a1").value = 1 then range("a1").

select

end sub

2、跳到 如sheet1中f1有個數「c6」,private sub worksheet_calculate()if range("b1").value = 2 and range("a1").value = 1 then range(range("f1").

value).select

end sub

3樓:匿名使用者

1、在thisworksheet中插入**。

private sub worksheet_calculate()if sheet1.range("b1").value = 2 and sheet1.

range("a1").value = 1 then

sheet2.activate

range("c1").select

end if

end sub

2、查詢表2中c列值等於表1中f1值,相等則跳轉。

for i=1 to sheet2.[c65536].end(xlup).row

sheet2.activate

range("c"&i).select

exit for

end if

next

Excel求教用VBA解決浮點誤差

原因 這是由於浮點運算造成的。在微軟官方有詳細說明的 0.65 10 0.101001100110011001100110011001100110011.2 0.6 10 0.10011001100110011001100110011001100110011.2目前計算機上儲存浮點數值是按照ieee...

VBA整型變數問題,關於VBA中變數問題!

不用那麼麻煩 如果你只是想比較單元格顯示的內容的大小的話只要用cells i,j text來代替cells i,j value就可以了 cells的預設屬性是value,所以cells i,j 表示的是cells i,j value 所以你的 可以改成 dim i as integer,j as i...

關於VBA的問題,一個關於VBA的問題

樓主,你的問題在於你把 select case d14中的d14認為是單元格d14,其實d14根本就不是你的單元格d14,而是一個未宣告和賦值的variant變數,其值預設為 字串,它是永遠大於6的。所以你的e18永遠等於999.不等於1000是因為你在we we 1這個計數發生前,就把值賦給了e1...