[英]Excel - Match values with corresponding column, check value and delete rows
[英]Match string in column and sum corresponding rows
在新的 VBA 模塊中試試這個:
Sub CalculateFinancials()
Dim aCells As Range
Dim aCell As Range
Dim cellValue As String
Dim foreignCurrency As Double
Dim nationalCurrency As Double
Set aCells = Range("A:A")
For Each aCell In aCells
cellValue = aCell.Value
If InStr(cellValue, "A75") <> 0 And cellValue <> "A75" Then
foreignCurrency = foreignCurrency + Cells(aCell.Row, 3)
End If
If InStr(cellValue, "A71") <> 0 And cellValue <> "A71" Then
nationalCurrency = nationalCurrency + Cells(aCell.Row, 3)
End If
Next aCell
Cells(13, 3) = foreignCurrency
Cells(4, 3) = nationalCurrency
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.