Loop macro

I need help in running the current macro in a loop in order to copy columns to an XML file. I have data in multiple columns C, E, G, etc.

Private Sub CommandButton1_Click()

Dim iCntr

Dim strFile_Path As String

Dim Filename As String

‘Change cell reference accordingly

Filename = Sheets(“Information”).Range(“E8”)

strFile_Path = “C:\Temp\CCH\” & Filename & “” & Format(Now(), “dd-MMM-yyyy h-m-s”) & “.xml”

Open strFile_Path For Output As #1

For iCntr = 2 To 110

Print #1, Sheets(“Target”).Range(“C” & iCntr)

Next iCntr

Close #1

End Sub


Top Contributor Asked 7 days ago in VBA: Macros.

Any urgent help on this will be deeply appreciated

6 days ago.
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.