[英]If column A equals a certain value, generate a value in column B. Check each cell in column A --> Generate a value in each cell in column B
Akash 您不需要為此編寫 vba 代碼。 您可以使用查找表並應用@BigBen 所說的 Vlookup 公式。
除此之外,如果您忽略一些拼寫錯誤,這個公式會讓您感到高興。 在單元格 B2 中輸入此內容並向下粘貼。
="It's " & A2
如果您更喜歡使用 VBA 代碼而不是 Ozgun Senyuva 建議的公式。 你可以試試這個代碼:
Dim myLine As Double
Dim myFood As String
myLine=2
myFood=" an other thing"
With SavedData
Do While .Cells(myLine, 1)<>"" 'Assume that Category is in column A, and Generated Asset Name is in column B
If .Cells(myLine, 1)="Sandwiches" Then
myFood=" a Sandwich"
Else If .Cells(myLine, 1)=" Wraps" Then
myFood=" a Wrap"
End If
.Cells(myLine, 2)="It's" & myFood
myLine=myLine+1
Loop
End With
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.