Excel Macro - Create new files from ranges
Closed
Jiminie.Glick
Posts
3
Registration date
Wednesday 15 February 2012
Status
Member
Last seen
20 February 2012
-
15 Feb 2012 à 10:37
Jiminie.Glick Posts 3 Registration date Wednesday 15 February 2012 Status Member Last seen 20 February 2012 - 20 Feb 2012 à 16:32
Jiminie.Glick Posts 3 Registration date Wednesday 15 February 2012 Status Member Last seen 20 February 2012 - 20 Feb 2012 à 16:32
Related:
- Excel Macro - Create new files from ranges
- Excel mod apk for pc - Download - Spreadsheets
- Excel online macros - Guide
- Create new skype account - Guide
- How to open .swf files - Guide
- How to merge and compare two excel files - Guide
3 responses
Jiminie.Glick
Posts
3
Registration date
Wednesday 15 February 2012
Status
Member
Last seen
20 February 2012
1
20 Feb 2012 à 16:32
20 Feb 2012 à 16:32
I ended up modifying it to this:
Sub Copy_Section_Paste_New_Workbook()
Dim j As Long, k As Long, n As Long
n = 1
j = 5
Do
Range(Cells(j, "F"), Cells(j + 56, "S")).Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveWindow.Zoom = 85
Range("A4").Select
ActiveCell.FormulaR1C1 = "_201201"
Range("A5").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(R[-2]C,R[-1]C)"
ThisFile = Range("b1").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
If ActiveWorkbook.Saved = False Then
ActiveWorkbook.Save
End If
ActiveWorkbook.Close
j = j + 59
n = n + 1
If n > 115 Then Exit Do
Loop
End Sub
Thanks again! I wouldn't have figured it out without your help!!!
Jiminie
Sub Copy_Section_Paste_New_Workbook()
Dim j As Long, k As Long, n As Long
n = 1
j = 5
Do
Range(Cells(j, "F"), Cells(j + 56, "S")).Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveWindow.Zoom = 85
Range("A4").Select
ActiveCell.FormulaR1C1 = "_201201"
Range("A5").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(R[-2]C,R[-1]C)"
ThisFile = Range("b1").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
If ActiveWorkbook.Saved = False Then
ActiveWorkbook.Save
End If
ActiveWorkbook.Close
j = j + 59
n = n + 1
If n > 115 Then Exit Do
Loop
End Sub
Thanks again! I wouldn't have figured it out without your help!!!
Jiminie
venkat1926
Posts
1863
Registration date
Sunday 14 June 2009
Status
Contributor
Last seen
7 August 2021
811
16 Feb 2012 à 06:19
16 Feb 2012 à 06:19
NOT VERIFIED AS NUMBER OF TIMES IS TOO LARGE
Sub test()
Dim j As Long, k As Long, n As Long
Worksheets("sheet1").Activate
Do
n = 1
j = 5
Range(Cells(j, "F"), Cells(j + 56, "S")).Copy
Worksheets("sheet2").Cells(Rows.Count, "F").End(xlUp).Offset(1, 0).PasteSpecial
j = j + 59
n = n + 1
If n > 115 Then Exit Do
Loop
End Sub
Jiminie.Glick
Posts
3
Registration date
Wednesday 15 February 2012
Status
Member
Last seen
20 February 2012
1
20 Feb 2012 à 16:28
20 Feb 2012 à 16:28
Thanks venkat1926! That helped me out a lot!!!