I have a macro to upload various files to a folder. I would like these uploaded in the same order from BR1JNLasCSV to HPRJNLasCSV
It would be appreciated if someone could kindly amend my code
See link below showing order files should be once uploaded
It would be appreciated if someone could kindly amend my code
See link below showing order files should be once uploaded
Login - Dropbox
Login to Dropbox. Bring your photos, docs, and videos anywhere and keep your files safe.
www.dropbox.com
Code:
Sheets("BR1 JNL").Select
Dim vTemp As Variant
Dim LR As Long
Dim lC As Long
Dim i As Long
Dim indexColumn As Long
Dim indexRow As Long
' get depth of rows from column A
LR = Cells(Rows.Count, 1).End(xlUp).Row
'get width of data from row 1 (header)
lC = Cells(1, Columns.Count).End(xlToLeft).Column
'open the file as output
Open "c:\Journal Templates\BR1 JNL.csv" For Output As #1
'move throught the spreadsheet, 1 row down all columns across
For indexRow = 1 To LR Step 1
For indexColumn = 1 To lC Step 1
'remove " from cells
vTemp = Trim(Replace(Cells(indexRow, indexColumn), Chr(34), "'"))
'Print headers so they are clear MyAddess1 rather than "Myaddress1"
If (indexRow = 1) Then
If (indexColumn = lC) Then
Print #1, vTemp ' end of line
Else
Print #1, vTemp & ","; ' comma sep (required for the print statement
End If
Else
If indexColumn = lC Then
Write #1, vTemp 'end of line using write
Else
Write #1, vTemp; 'continuation of line using write
End If
End If
Next indexColumn
Next indexRow
Close #1
End Sub
Sub PEJNLasCSV()
Sheets("PE VAT JNL").Select
Dim vTemp As Variant
Dim LR As Long
Dim lC As Long
Dim i As Long
Dim indexColumn As Long
Dim indexRow As Long
' get depth of rows from column A
LR = Cells(Rows.Count, 1).End(xlUp).Row
'get width of data from row 1 (header)
lC = Cells(1, Columns.Count).End(xlToLeft).Column
'open the file as output
Open "c:\Pinnacle Journal Templates\PE Vat JNL.csv" For Output As #1
'move throught the spreadsheet, 1 row down all columns across
For indexRow = 1 To LR Step 1
For indexColumn = 1 To lC Step 1
'remove " from cells
vTemp = Trim(Replace(Cells(indexRow, indexColumn), Chr(34), "'"))
'Print headers so they are clear MyAddess1 rather than "Myaddress1"
If (indexRow = 1) Then
If (indexColumn = lC) Then
Print #1, vTemp ' end of line
Else
Print #1, vTemp & ","; ' comma sep (required for the print statement
End If
Else
If indexColumn = lC Then
Write #1, vTemp 'end of line using write
Else
Write #1, vTemp; 'continuation of line using write
End If
End If
Next indexColumn
Next indexRow
Close #1
End Sub