我發現真正接近我的,但作爲答案的問題是具體到我不能完全將它與我的問題。如果不是......否則跳過
我正在使用一個if函數來填充已經有值的列,我希望它覆蓋值,如果條件存在,如果他們不希望它離開它的價值如何。
換句話說,我想要的功能的「其他」部分說跳躍或類似的東西...我已經試過「空」,「跳過」和其他幾個人,但沒有運氣。
下面是情況下,我的代碼部分忽略我的代碼問題,這是不是最終產品,以防萬一你需要一些變量的基本思路是必要的。謝謝你在前進!:
子ReportCompareAlta() ' ' ReportCompareAlta宏 「再添實例,其中列d是 」ALTA「
Dim varSheetA As Variant
Dim varSheetB As Variant
Dim varSheetC As Variant
Dim StrValue As Variant
Dim strRangeToCheck As String
Dim iRow As Long
Dim iCol As Long
Dim WbkA As Workbook
Dim WbkB As Workbook
Dim WbkC As Workbook
Dim counter As Long
Set WbkA = Workbooks.Open(Filename:="G:\Reporting\AH_MISSE_FEB2013.xls")
Set WbkB = Workbooks.Open(Filename:="G:\Reporting\AH_MISSE_MAR2013.xls")
Set WbkC = Workbooks.Open(Filename:="G:\Reporting\ReportCompare.xls")
Set varSheetA = WbkA.Worksheets("LocalesMallContratos")
Set varSheetB = WbkB.Worksheets("LocalesMallContratos")
Set varSheetC = WbkC.Worksheets("Sheet1")
strRangeToCheck = "A1:IV65536"
Debug.Print Now
varSheetA = WbkC.Worksheets("Sheet2").Range(strRangeToCheck) 'may be confusing code here
varSheetB = WbkC.Worksheets("Sheet3").Range(strRangeToCheck) 'may be confusing code here
Debug.Print Now
counter = 0
For iRow = LBound(varSheetA, 1) To UBound(varSheetA, 1)
If varSheetB(iRow, "B") = varSheetA(iRow, "B") & varSheetB(iRow, "B") <> "GERENCIA" & varSheetB(iRow, "B").Value <> "" & varSheetB(iRow, "D") = "ALTA" Then
StrValue = ""
varSheetB.Range("iRow:B").Select
Selection = StrValue
ActiveSheet = varSheetC
Range("A1").Select
Selection.Offset(counter, 0).Value = StrValue
counter = counter - 1
Else
"SKIP"
End If
Next iRow
末次
感謝幫助@nullptr – 2013-05-03 13:33:09