Multiple Text files using Loop in VB

I need help in generating multiple text files i.e. loop function in the following VB, can someone help  in modifying this.
Private Sub CommandButton2_Click()
Dim iCntr

Dim strFile_Path As String
strFile_Path = “C:\Users\Desktop\Assignee” & Format(Now(), “dd-MMM-yyyy h-m-s”) & “.txt”
Open strFile_Path For Output As #1
For iCntr = 2 To 4620

Print #1, Sheets(“ImportTemplate2016”).Range(“D” & iCntr)

Next iCntr
Close #1

End Sub


Top Contributor Asked on January 23, 2017 in VBA: Programming.
Add Comment
0 Answer(s)
  • Found this useful?

    Please share using the share button above.

    If you found the answer is best answer for your question, Please mark as 'best answer' by clicking on the right tick mark icon at the left side of the answer.

    Found the answer useful and wants to credit the user, then vote the answer (vote up).

  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.