我想創建中VBA的情況下一個「:)」將在列AL當列AJ & AK值是相同的:使用「案例」,當兩列相等
Sub ColumnAL()
Dim LockDays, StartCounter, LastRow, Equal, BuySideLockDays, PreviousCell
Worksheets("Table").Activate
LastRow = LastRowNum(Sheets("Table"))
Cells(1, 36).Value = "BuySideLockDays"
Cells(1, 37).Value = "LockDays"
Cells(1, 38).Value = "Equal"
For StartCounter = 2 To LastRow
LockDays = Cells(StartCounter, 37).Value
Select Case LockDays
Case Is = BuySideLockDays
Equal = ":)"
Case Else
Equal = "!!!"
End Select
Cells(StartCounter, 38).Value = Equal
Next StartCounter
End Sub
我我還使用PublicFunction設置,這似乎是我的工作數量LASTROW:
Public Function LastRowNum(Sheet As Worksheet) As Long
If Application.WorksheetFunction.CountA(Sheet.Cells) <> 0 Then
LastRowNum = Sheet.Cells.Find(What:="*", _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
Else
LastRowNum = 1
End If
End Function
Excel工作表是目前唯一的「回!」
在您的代碼中'BuySideLockDays'永遠不會被賦值。 –