Хорошо. Это то, что я имею в колонке A1: A100:Сравнение текста из одной колонки для определения вывода другого столбца
12V Automotive Products
12V Automotive Products
12V Automotive Products
12V Automotive Products
12V Automotive Products
12V Automotive Products
12V Automotive Products
12V Automotive Products
12V Automotive Products
12V Automotive Products
12V Automotive Products
12V Automotive Products
A/V Cables
Accessories
Accessories
Accessories
Accessories
Accessories
Accessories
Accessories
Accessories
Accessories
Accessories
Accessories
Action
Action
Action
Action
Action
Action
Action
Action
Action
Action
Action
Action
Action
Action
Action
Action
Action
Action
Action
Action & Adventure
Action & Adventure
Adapters
Adapters
Adapters
Adapters
Adapters & Splitters
Adapters & Splitters
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
Adventure
И это код:
Sub FillColumnB()
Dim rng As Range, cl As Range
Set rng = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
For Each cl In rng
If cl = "12V Automotive Products" Then
cl.Offset(0, 1) = "tdexjxr"
ElseIf cl = "Accessories" Then
cl.Offset(0, 1) = "s6ii"
ElseIf cl = "Action" Then
cl.Offset(0, 1) = "7ks57k5k"
ElseIf cl = "Action & Adventure" Then
cl.Offset(0, 1) = "kxee5xskex"
ElseIf cl = "Adapters" Then
cl.Offset(0, 1) = "kxykk5ezw"
ElseIf cl = "Adobe Titles" Then
cl.Offset(0, 1) = "kz46yk78"
ElseIf cl = "Adventure" Then
cl.Offset(0, 1) = "l8rrzlez"
ElseIf cl = "All Toys" Then
cl.Offset(0, 1) = "ezlllels6"
ElseIf cl = "Animation" Then
cl.Offset(0, 1) = "988l7889l"
ElseIf cl = "Anti-Virus/Anti-Spyware" Then
cl.Offset(0, 1) = "wq3w"
ElseIf cl = "Applications" Then
cl.Offset(0, 1) = "jrd5j"
ElseIf cl = "Arcade" Then
cl.Offset(0, 1) = "drj76j"
ElseIf cl = "Arts & Humanities" Then
cl.Offset(0, 1) = "8l"
End If
Next
End Sub
Мой вопрос почему выше код не работает?
И мой вопрос будет: что код *** должен делать ** *, и что он делает вместо этого (если что-нибудь)? Если вы получите сообщение об ошибке - пожалуйста, сообщите нам, что это за ошибка! (полное и точное сообщение об ошибке, пожалуйста!) –
Предположим, что для чтения текста в ячейках столбца A и в соответствии с данными в ячейках выводится то, что я хочу в столбце B. Но это ничего не делает. Нет ошибок. Фактически, с меньшим количеством строк текста (около 10 строк) это действительно работает. – user3733492
«Почему это не работает» бесполезно для людей, которые хотят помочь. В следующий раз сообщите соответствующую информацию о том, что «не работает» – cheezsteak