делаю такого рода запрос: Private Sub CommandButton1_Click() Dim response As VbMsgBoxResult response = MsgBox("Выполнить обновление?", vbQuestion + vbYesNo, "Подтверждение действия")
If response = vbYes Then Dim ws As Worksheet Dim rng As Range Dim cell As Range Dim jsonData As String Dim xhr As Object Dim response_1 As String
Set ws = ThisWorkbook.Sheets("Нов_цена")
Dim lastRow As Long lastRow = ws.Cells(ws.Rows.Count, "M").End(xlUp).Row
Set rng = ws.Range("M10:N" & lastRow)
jsonData = "{""Prices"" : ["
isFirstRow = True
' Iterate through each row in the range For Each cell In rng.Rows ' Check if the row is empty isEmptyRow = True For Each innerCell In cell.Cells If Not IsEmpty(innerCell.Value) And IsNumeric(innerCell.Value) Then isEmptyRow = False Exit For End If Next innerCell
' If the row is not empty and all cells contain numeric values, process it If Not isEmptyRow Then jsonData = jsonData & "{" jsonData = jsonData & """price"":""" & (cell.Cells(1, 2).Value) & """," jsonData = jsonData & """product_id"":" & (cell.Cells(1, 1).Value) & "" jsonData = jsonData & "}," End If Next cell
' Remove the trailing comma If Len(jsonData) > 1 Then jsonData = Left(jsonData, Len(jsonData) - 1) End If
jsonData = jsonData & "]}"
' Debug the JSON string MsgBox jsonData
' Create WinHttpRequest object Set xhr = CreateObject("WinHttp.WinHttpRequest.5.1")