Keresés

Új hozzászólás Aktív témák

  • Fire/SOUL/CD

    félisten

    válasz Zomb€€ #8895 üzenetére

    Ok, akkor inkább szavak helyett. :DDD

    'itt add meg, mi legyen az ELVÁLASZTÓ karakter
    Const MYDELIMITER = ";"
    Dim MyCell As Range
    Dim MyRow As Range
    Dim MyCellValue As String
    Dim MyFname As String
    Dim MyFnum As Long
    Dim MyRange As Range



    Private Sub CommandButton1_Click()

    'itt add meg a táblázatod tartományát
    Set MyRange = Range("A1:B7")

    MyFname = "D:\FIRE\" & Format(Now(), "yyyy.mm.dd") & ".csv"

    If Not Dir(MyFname) = vbNullString Then
    UserChange = MsgBox(prompt:="A fájl (" & MyFname & ") már létezik. Felülírja?", Title:="Megerősítés", Buttons:=vbYesNo)
    If UserChange = vbYes Then WriteMyFile
    Else
    WriteMyFile
    End If

    End Sub



    Private Sub WriteMyFile()

    MyFnum = FreeFile
    Open MyFname For Output As MyFnum
    For Each MyRow In MyRange.Rows
    For Each MyCell In MyRow.Cells
    MyCellValue = MyCellValue & MyCell.Value & MYDELIMITER
    Next MyCell
    MyCellValue = Left(MyCellValue, Len(MyCellValue) - 1)
    Print #MyFnum, MyCellValue
    MyCellValue = ""
    Next MyRow
    Close MyFnum

    End Sub

Új hozzászólás Aktív témák

Hirdetés