Question : VBA routien - simple code help

Hi,

I have a VBA routien which goes thourgh 'x' number of columns for 'X' number of rows.
The code is as below.
I want check if all the columns in the row are empty apart from first column. if(true) than break out of loop
Can any one please tell me the best/clean way to amend the code to be able to achieve that?

I know I can do it myself but may not be the cleanest way :/


Thanks alot
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
i = sLineStart
    j = ColRef2ColNum(sColStart)
    sColumnTitle = ""
    Do While Len(Range(ColNum2ColRef(j) & i).Formula) > 0
        sColumnTitle = sColumnTitle & "`" & Cells(i, j) & "`,"
        j = j + 1
    Loop
    sColumnTitle = Mid(sColumnTitle, 1, Len(sColumnTitle) - 1)
    iNumColumn = j

    i = i + 1
    j = ColRef2ColNum(sColStart)
    'Recuperation des données lignes par lignes
    If iLineNum > 0 Then
        For i = i To i + iLineNum - 1
            sSQL = ""
            sql = ""
            'Recuperation des données de la ligne pour chaque colonne
            For j = ColRef2ColNum(sColStart) To iNumColumn - 1
                sSQL = sSQL & Cells(i, j) & "','"
            Next j
            sSQL = Mid(sSQL, 1, Len(sSQL) - 3)
            'Break out of function if user hasn't enter any value
                If InStr(sSQL, "[please specify]") Then
                ExecuteUpdate = True
                Exit Function
                End If
            'Insertion des données dans la table
            
            sql = "INSERT INTO [" & sTableName & "] (" & sColumnTitle & ") values ('" & sSQL & "');"
            oConnection.Execute sql
            Tracer " OK- Query: " & sql
        Next i

Answer : VBA routien - simple code help

>> Error: Expected ','
>> Error: Object Expected
is there any line numbers mentioned in the error console?
Take a look at your code carefully. Something is missing...
Probably you have some variables with one and the same name...?!
Change
function onChngIntPceAll() {
for (i=0; i<20; i++) {
onChngIntPce(i);
}
}
to
function onChngIntPceAll() {
  for (indx=1; indx < 22; indx++) onChngIntPce(indx);
}
Also place this debug msg:
alert('onChngIntPce invoked for : ' + idx); just after this line function onChngIntPce(idx) {
so your onChngIntPce(idx) function will look like:

function onChngIntPce(idx) {
alert('onChngIntPce invoked for : ' + idx); // remove this msg later
if (document.getElementById("intPce"+idx).value > 1) document.getElementById("sel"+idx).selectedIndex = 1;
calcVAT();
SumExVAT();
Totals();
proc();
}
Random Solutions  
 
programming4us programming4us