Search notes:
Excel: Turn selected region into SQL Insert Statements
tableName = "xxx"
for each r in selection.rows : _
r_= application.transpose(application.transpose(r.value)) : _
c_ = r_ : _
i = 1 : _
for each c in r.value : _
select case vartype(c ) : _
case vbInteger, vbLong, vbSingle, vbDouble : _
c_(i) = c : _
case vbDate : _
c_(i) = "date '" & format(c, "yyyy-mm-dd") & "'" : _
case vbString : _
c_(i) = "'" & replace(c, "'", "''") & "'" : _
case vbEmpty : _
c_(i) = "null" : _
case else : _
c_(i) = "? " & vartype(c) & " ? " : _
end select : _
i = i+1 : _
next c : _
debug.print("insert into " & tableName & " values(" & _
join(c_, ",") & ");") : _
next r