rakeshbrraag
New member
- Joined
- Nov 23, 2012
- Messages
- 10
- Reaction score
- 0
- Points
- 0
- Excel Version(s)
- 2013
Hello Everyone,
I have a problem with joining the two macros.
This is the first macro: This macro copies certain columns and rows multiple times in the sheet.
Dim lastr As Double
Dim cols As Double
cols = Sheets("row").Range("V4").Value * 3 ' Determine how many columns to copy across
With Sheets("campaingn_1")
lastr = .UsedRange.Rows.Count ' Last used row in worksheet
.Range("D1:F" & lastr).Select
Selection.AutoFill Destination:=Range(Cells(1, 4), Cells(lastr, cols + 3)), Type:=xlFillDefault
Columns("D:F").Select
Selection.Copy
Columns("G:XFD").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Rows("18:18").Select
Selection.AutoFill Destination:=Rows("18:329"), Type:=xlFillDefault
Rows("18:329").Select
Range("C18").Select
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("C18").Select
End With
Here is the second Macro: This macro duplcates the sheet( " template") and also renames those duplicated sheets specific number of times.
Dim iLoop As Integer, iCount As Integer
iCount = Sheets("Row").Range("V1").Value
For iLoop = 1 To iCount
Sheets("Template").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Campaign_" & iLoop
ActiveSheet.Range("C2").Value = Sheets("Row").Range("T" & iLoop + 3).Value
Next
Now i need a single macro which works like this:
It has to execute the second macro( duplication of the sheet "row" specific number of times) and execute the first macro in each and every duplicated sheets( here the duplication of sheets is done by second macro as explained above). please help me out with this as soon as possible
Thanks in advance
I have a problem with joining the two macros.
This is the first macro: This macro copies certain columns and rows multiple times in the sheet.
Dim lastr As Double
Dim cols As Double
cols = Sheets("row").Range("V4").Value * 3 ' Determine how many columns to copy across
With Sheets("campaingn_1")
lastr = .UsedRange.Rows.Count ' Last used row in worksheet
.Range("D1:F" & lastr).Select
Selection.AutoFill Destination:=Range(Cells(1, 4), Cells(lastr, cols + 3)), Type:=xlFillDefault
Columns("D:F").Select
Selection.Copy
Columns("G:XFD").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Rows("18:18").Select
Selection.AutoFill Destination:=Rows("18:329"), Type:=xlFillDefault
Rows("18:329").Select
Range("C18").Select
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("C18").Select
End With
Here is the second Macro: This macro duplcates the sheet( " template") and also renames those duplicated sheets specific number of times.
Dim iLoop As Integer, iCount As Integer
iCount = Sheets("Row").Range("V1").Value
For iLoop = 1 To iCount
Sheets("Template").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Campaign_" & iLoop
ActiveSheet.Range("C2").Value = Sheets("Row").Range("T" & iLoop + 3).Value
Next
Now i need a single macro which works like this:
It has to execute the second macro( duplication of the sheet "row" specific number of times) and execute the first macro in each and every duplicated sheets( here the duplication of sheets is done by second macro as explained above). please help me out with this as soon as possible
Thanks in advance