Я новичок / учусь на VBA.Для этой проблемы я не получаю кнопку отладки при запуске моего кода, поэтому я не могу найти ошибку.Ошибка просто говорит «400», когда я запускаю макрос ниже, без опции отладки после.
Sub Search_and_Copy_Discount_and_Shopper()
Dim strStartingCell As String
Dim strCustomer As String
Dim strDiscount As String
Dim strShopper As String
'store starting place
'look at column A, store value
strStartingCell = ActiveCell.Address
strCustomer = ActiveCell.Offset(0, -1).Value
'go to customer sheet
Sheets("Customer").Select
Range("A2").Select
'compare values in A to strCustomer
'if it matches, copy cells 1 and 2 to the right in values
'if no match, go down one cell and check again
Do While IsEmpty(ActiveCell.Value) = False
If ActiveCell.Value = strCustomer Then
strDiscount = ActiveCell.Offset(0, 1).Value
strShopper = ActiveCell.Offset(0, 2).Value
Exit Sub
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
'go back to purchases sheet
Sheets("Purchases").Select
'copy in current cell and cell 1 to the right
Range(strStartingCell).Select
'paste strDiscount in current cell
'paste strShopper in cell 1 to the right
ActiveCell.Value = strDiscount
ActiveCell.Offset(0, 1).Value = strShopper
End Sub
Будем очень благодарны за любые указатели или ошибки, которые вы можете определить!