I want my code to check if cells (i, 12) starts with 262015 - This part works.
It should then create a CSV-file, where i put in some info from "Base"-sheet in (i, 2), (i, 6) cells.
If the file already exists, it should ask before overwriting OR it can just rename it with another number than the already existing file (But then the user needs to get informed about it) Can you maybe help me?
Sub Opgave8()
Dim sh As Worksheet
Dim Pth As String
Application.ScreenUpdating = False
Pth = ActiveWorkbook.Path
Set sh = Sheets.Add
For i = 2 To 18288
If Left(Worksheets("Base").Cells(i, 12), 6) = "262015" Then
sh.Cells(i, 2) = Worksheets("Base").Cells(i, 4)
End If
Next i
sh.Move
With ActiveWorkbook
.SaveAs FileName:=Pth & "\AdminExport.csv", FileFormat:=xlCSV
.Close False
End With
Application.ScreenUpdating = True
End Sub