gpt-4-0314· OpenAI
WildChat-4.8M (AI2)
VBA 編程 歷工作表1至工作表20 工作表 1的Z2單元格有底色才進行運算 工作表1單元格Z2 等於 工作表99 的單元格i2 減 工作表1 的 單元格 i2 結果…
- User
VBA 編程 歷工作表1至工作表20
工作表 1的Z2單元格有底色才進行運算
工作表1單元格Z2 等於 工作表99 的單元格i2 減 工作表1 的 單元格 i2 結果 介乎於負0.00001至負0.5值,顯示工作表99 的單元格 F2 減 工作表1 單元格 F2的值,否則顯示為空白
工作表 1的AA2單元格有底色才進行運算 工作表1單元格AA2 等於 工作表99 的單元格i2 減 工作表1 的單元格 i2 結果 介乎於負0.00001至負0.5值,顯示工作表99 的單元格 G2 減 工作表1的 單元格 G2的值,否則顯示為空白
工作表 1的AB2單元格有底色才進行運算 工作表1單元格AB2 等於 工作表99 的單元格i2 減 工作表1 的單元格i2 結果 介乎於負0.00001至負0.5值,顯示工作表99 的單元格 H2 減 工作表1 的單元格 H2的值,否則顯示為空白
單完格如此類推至第400行
- Assistant
以下是根據您的需求編寫的VBA代碼:
Sub Calculate() Dim WS1 As Worksheet, WS99 As Worksheet Dim i As Long, j As Long Set WS99 = Worksheets("Sheet99") For j = 1 To 20 Set WS1 = Worksheets("Sheet" & j) For i = 2 To 400 If WS1.Cells(i, 26).Interior.Color <> RGB(255, 255, 255) Then If WS99.Cells(i, 9).Value - WS1.Cells(i, 9).Value > -0.00001 And WS99.Cells(i, 9).Value - WS1.Cells(i, 9).Value < -0.5 Then WS1.Cells(i, 26).Value = WS99.Cells(i, 6).Value - WS1.Cells(i, 6).Value Else WS1.Cells(i, 26).Value = "" End If End If If WS1.Cells(i, 27).Interior.Color <> RGB(255, 255, 255) Then If WS99.Cells(i, 9).Value - WS1.Cells(i, 9).Value > -0.00001 And WS99.Cells(i, 9).Value - WS1.Cells(i, 9).Value < -0.5 Then WS1.Cells(i, 27).Value = WS99.Cells(i, 7).Value - WS1.Cells(i, 7).Value Else WS1.Cells(i, 27).Value = "" End If End If If WS1.Cells(i, 28).Interior.Color <> RGB(255, 255, 255) Then If WS99.Cells(i, 9).Value - WS1.Cells(i, 9).Value > -0.00001 And WS99.Cells(i, 9).Value - WS1.Cells(i, 9).Value < -0.5 Then WS1.Cells(i, 28).Value = WS99.Cells(i, 8).Value - WS1.Cells(i, 8).Value Else WS1.Cells(i, 28).Value = "" End If End If Next i Next j End Sub
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.