Hello, I am new to writing scripts in VB. My question is..
I have a workbook in Excel and it has suppose columns A,B,C,D,E,F and G. I am generating a sql script from Excel and when I run the script, all the values would be stored in a table in SQL server. I am having trouble in writing the scritp, when I do not want all the columns, but only columns A,C and E. below is a script ive written. Please help..
Public Sub GenerateSQLInserts()
Dim sqlInsert, sqlSelect, sqlOut As String
Dim row, col As Range
sqlInsert = "INSERT INTO [tbl_DMaskLoad]"
sqlOut = ""
For Each row In Range("A1").CurrentRegion.Rows
sqlSelect = "SELECT "
For Each col In row.Cells
sqlSelect = sqlSelect & col & ", "