我确信这将是相当直接的,但我正在努力克服这种逻辑。我尝试根据填充的数据创建行计数,然后循环遍历所有空单元格,直到填充了notes列的字段为止。这个想法是这个值/注释然后写入SQL表。
我到目前为止的代码是:
NoteCount = WorksheetFunction.CountA(Sheets("Missing").Range("B10:B7500"))
Sheets("Missing").Range("L10").Select
For i = 10 To NoteCount
If ActiveCell.Value = "" Then
Next i
Else:
'SQL Code entered here'
End If
Next I
我知道这段代码没有用,因为我的For循环没有对齐,但我只是试图展示我想要实现的目标。
答案 0 :(得分:3)
使用以下代码可以更短更简单地实现:
var mangoes, mangoes2;
var deferred1 = $.getJSON("mangoesurl.com/json");
var deferred2 = $.getJSON("mangoesurl.com/json2");
$.when(deferred1, deferred2).then(function(data1, data2){
mangoes = data1;
mangoes2 = data2;
}, function(error){
//Determine which mangoes has failed here
});
答案 1 :(得分:1)
如果您有大量数据,您可能会发现某些方法非常慢。这比循环遍历列中的每个单元格更快:
Sub test()
Dim rng As Range, found As Range
Dim firstAddress As String
With ThisWorkbook.Worksheets("Missing")
Set rng = .Range(.Range("B10"), .Cells(.Rows.Count, "B").End(xlUp))
Set rng = rng.Offset(0, 10)
End With
Set found = rng.Find("", , , xlWhole)
If Not found Is Nothing Then
firstAddress = found.Address
Do
'SQL code entered here
Set found = rng.FindNext(found)
Loop While Not found.Address = firstAddress
End If
End Sub