Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.
Sub csv_Export() Dim lastColumn As Integer Dim lastRow As Integer Dim strString As String Dim i As Integer, j As Integer Dim UD As String UD = CreateObject("WScript.Shell").specialfolders("Desktop") UD = UD & "\export.csv" Worksheets("TEST").Activate lastColumn = ActiveSheet.UsedRange.Column - 1 + ActiveSheet.UsedRange.Columns.Count lastRow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row Open UD For Output As #1 For i = 1 To lastRow Cells(i, 1).Select strString = "" For j = 1 To lastColumn If j <> lastColumn Then strString = strString & Cells(i, j).Value & ";" ' Use semicolon instead of pipe. Else strString = strString & Cells(i, j).Value End If Next j If Len(Trim$(Replace(strString, ";", ""))) > 0 Then Print #1, strString End If Next i Close #1 End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|A WS within a WS||11||42|
|Cross checking component service dlls||2||46|
|count values within multiple bands||7||35|
|Linking Cells within workbooks - how to mass re-direct to a different sheet within a workbook||5||15|
Join the community of 500,000 technology professionals and ask your questions.