export querry to excel, skip one row

benjamin.grimm

Registered User.
Local time
Yesterday, 23:17
Joined
Sep 3, 2013
Messages
125
hello^^^

i export data via vba from access to excel.

Here my VBA.

Code:
Dim xlApp As Object ' Excel.Application
Dim xlBook As Object ' Excel.Workbook
Dim xlSheet As Object ' Excel.Worksheet
Dim rst As DAO.Recordset
'Excel-Objekt öbffnen und Workbook hinzufügen
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Open("Z:\BUS MMM C\20000 Bestandsmanagement & Net Assets\21000 Bestandsführung\21200 Reporting\21240 Bestände Vorratsfzge\2014\Datenbank\Export.xlsx")
'In Tabellenblatt 1 schreiben
Set xlSheet = xlBook.Worksheets(1)
Set rst = CurrentDb.OpenRecordset("Vorratseinplannung_Citaro")
xlSheet.Range("A4").CopyFromRecordset rst
rst.Close
'In Tabellenblatt 2 schreiben
Set xlSheet = xlBook.Worksheets(2)
Set rst = CurrentDb.OpenRecordset("Vorratseinplannung_Conecto")
xlSheet.Range("A4").CopyFromRecordset rst
rst.Close
'Objekte schließen
Set rst = Nothing
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing

How can i do it that by exporting the data to excel, that it will skip one row.

Example:

I have the following querry

country/date apr may jun jul aug sep oct nov dec jan feb mar

AT
BE

It starts with A4 to J4 and then it will skip the row K4.

greetz benjamin
 
Column K you mean?

Simply create a column: SkipColumn: Null
on the place you want to keep the column empty

or "simply" code the empty column in using
Columns("K:K").Insert Shift:=-4161
 
thanks a lot. Very good help
 

Users who are viewing this thread

Back
Top Bottom