Im totally new to VBA and a little lost here. I have an Excel file with the holidays of my colleagues. There is a cell for every day of the year, where they need to put in an "X". I need to write a macro with VBA to export a CSV file, which exports their personnel number and the start- and enddate of their vacation. I also need a logic to skip weekends. I need the CSV File to import it to Visual Planning. It should be a table, with personnel number, start date and end date as columns How can i do that? Can you help me please?
Sub Makro1()
'
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ActiveWorkbook
Set ws = Worksheets("2021")
Dim ersteZeile As Integer
Dim letzteZeile As Integer
Dim c As Range
Dim datumRow As Integer
Dim d As Range
datumRow = 4
ersteZeile = 5
letzteZeile = ws.UsedRange.SpecialCells(xlCellTypeLastCell).Row
anfangsRange = "I" & ersteZeile
endrange = "NI" & letzteZeile
For Each c In ws.Range("I5:NI71")
If Not c.Value = "" Then
Cells(4, c.Column).Copy Destination:=Sheets("CSV").Column("BEGDA")
End If
Next c
End Sub
This is the code i got so far, but I need to copy the "X"es dynamically into my CSV Sheet.
