我需要幫助解決我的難題。我寫了一個很好的代碼。現在,用戶不僅希望看到最終結果,還希望看到用VBA編寫的公式(用於審計目的)來驗證結果是否正確。有沒有辦法在同一個單元格中顯示BOTH結果和公式?VBA在單元格中顯示BOTH結果和公式(用於審計目的)
我迄今爲止代碼:
Sub Vlookup_Condition_VAT_table()
Dim Rng As Range
Dim i As Long
Application.ScreenUpdating = False
Workbooks("GST_recovery_overclaim.xlsm").Worksheets("MonthlyData_Raw").Activate
'Identify the Destination location to start populating vlookuped values
Range("AK2").Activate
With Worksheets("MonthlyData_Raw").Cells
Set Rng = .Range("A1:A" & .Cells(.Rows.Count, 1).End(xlUp).Row)
For i = 2 To Rng.Rows.Count
'populate the destination range with
'vlookup values from the list vlookup table
Rng.Cells(i, 37) = Application.VLookup(.Cells(i, 28), Sheets("VAT_apportionment_table_201310").Range("D:G"), 4, False)
Next
End With
Application.ScreenUpdating = True
End Sub
非常感謝你, 拉斯
Guitarthrower,是的,它的工作原理。現在我還面臨另一個挑戰:添加ISERROR或IFERROR,並聲明出現錯誤時,請在行中向我提供「Not in exception list」語句。 「」和&&&我已經迷失了。你可以幫幫我嗎?如果你能向我解釋「」和「工作」,我將不勝感激。謝謝!!! – LearnForever