Hello
I want to use this VBA in may workflow. but i do not know hot to use invoke code or invoke vba
please help me (i want sample)
VBA
Option Explicit
Sub split_As_per_Rows()
Dim rngAll As Range
Dim SplitLine As Integer
Dim rowsCount As Long, colsCount As Integer
Dim strPath As String
Dim i As Long
Dim rowsNo As Long
Dim rngSplit As Range
Dim strName As String
Application.ScreenUpdating = False
Set rngAll = ActiveSheet.UsedRange
SplitLine = 50
rowsCount = rngAll.Rows.Count
colsCount = rngAll.Columns.Count
strPath = ThisWorkbook.Path & Application.PathSeparator
With ThisWorkbook
strName = Left(.Name, Len(.Name) - 5)
End With
For i = 2 To rowsCount Step SplitLine
rowsNo = i + SplitLine
Set rngSplit = Range(Cells(i, 1), Cells(rowsNo + 1, colsCount))
Workbooks.Add
rngAll.Rows(1).SpecialCells(2).Copy Cells(1, 1)
Range(Cells(2, 1), Cells(SplitLine + 1, colsCount)) = rngSplit.Value
Columns.AutoFit
ActiveWorkbook.SaveAs strPath & strName & "(" & ((i - 1) \ SplitLine) + 1 & ").csv", FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
Next i
Set rngAll = Nothing
Set rngSplit = Nothing
End Sub