Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15215

Insert To Excel Starting From Column E

$
0
0
Hi,

I'm trying to add info to an excel sheet but rather than add a new line each time I would like it to ignore the first 4 columns as these already contain formulas to generate a barcode.

Is this possible?

Code:

Dim MyConnection As System.Data.OleDb.OleDbConnection
            Dim MyCommand As New System.Data.OleDb.OleDbCommand
            Dim SQL As String
            MyConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + My.Settings.StockItemsFile + ";Extended Properties=Excel 12.0;")
            MyConnection.Open()
            MyCommand.Connection = MyConnection
            SQL = "Insert into [Stock Items$] ([Description],[Category],[Supplier],[Suppliers Code],[Price Each]) values('" + TextBox13.Text + "','" + ComboBox1.Text + "','" + ComboBox2.Text + "','" + TextBox14.Text + "','" + TextBox15.Text + "')"
            MyCommand.CommandText = SQL
            MyCommand.ExecuteNonQuery()
            MyConnection.Close()

Each time I run this I get the the info in the correct places but on line 1001 as my barcode formulas run to line 1000.

Thanks.

Viewing all articles
Browse latest Browse all 15215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>