Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
In my spreadsheet, I was wondering if I could set a macro to copy an entire
row, ask me how many copies of the line I would like to make, and paste them underneath the original line. Any help would be greatly appriciated! |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
More info but a macro using inputbox, find etc
Sub copyrows()'use FIND to find the row numrows = InputBox("Number of rows") + 1 Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows) End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "teo410" wrote in message ... In my spreadsheet, I was wondering if I could set a macro to copy an entire row, ask me how many copies of the line I would like to make, and paste them underneath the original line. Any help would be greatly appriciated! |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Click on any cell in the row and run:
Sub RowMaker() Dim r As Range, n As Long, nxtrow As Long, r2 As Range Set r = ActiveCell.EntireRow nxtrow = r.Row + 1 n = Application.InputBox(prompt:="How many rows", Type:=1) Set r2 = Range("A" & nxtrow & ":A" & nxtrow + n - 1) r.Copy r2 End Sub -- Gary''s Student - gsnu200860 "teo410" wrote: In my spreadsheet, I was wondering if I could set a macro to copy an entire row, ask me how many copies of the line I would like to make, and paste them underneath the original line. Any help would be greatly appriciated! |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
This is great but I need to INSERT not PASTE the rows in otherwise it pastes
over other information. "Gary''s Student" wrote: Click on any cell in the row and run: Sub RowMaker() Dim r As Range, n As Long, nxtrow As Long, r2 As Range Set r = ActiveCell.EntireRow nxtrow = r.Row + 1 n = Application.InputBox(prompt:="How many rows", Type:=1) Set r2 = Range("A" & nxtrow & ":A" & nxtrow + n - 1) r.Copy r2 End Sub -- Gary''s Student - gsnu200860 "teo410" wrote: In my spreadsheet, I was wondering if I could set a macro to copy an entire row, ask me how many copies of the line I would like to make, and paste them underneath the original line. Any help would be greatly appriciated! |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Works great thanks!
Just an additional thought, how could I get the macro to put a border at the bottom of the last row inserted up to column N? "Don Guillett" wrote: Sub copyrows() numrows = InputBox("Number of rows") 'Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows) Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows).Insert Application.CutCopyMode = False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "teo410" wrote in message ... This is great but I need to INSERT not PASTE the rows in otherwise it pastes over other information. "Gary''s Student" wrote: Click on any cell in the row and run: Sub RowMaker() Dim r As Range, n As Long, nxtrow As Long, r2 As Range Set r = ActiveCell.EntireRow nxtrow = r.Row + 1 n = Application.InputBox(prompt:="How many rows", Type:=1) Set r2 = Range("A" & nxtrow & ":A" & nxtrow + n - 1) r.Copy r2 End Sub -- Gary''s Student - gsnu200860 "teo410" wrote: In my spreadsheet, I was wondering if I could set a macro to copy an entire row, ask me how many copies of the line I would like to make, and paste them underneath the original line. Any help would be greatly appriciated! |
#7
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Sub copyrows()
numrows = InputBox("Number of rows") 'Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows) Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows).Insert Application.CutCopyMode = False Range(Cells(ActiveCell.Row, "a"), _ Cells(ActiveCell.Row + numrows, "n")) _ ..BorderAround Weight:=xlThick End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "teo410" wrote in message ... Works great thanks! Just an additional thought, how could I get the macro to put a border at the bottom of the last row inserted up to column N? "Don Guillett" wrote: Sub copyrows() numrows = InputBox("Number of rows") 'Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows) Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows).Insert Application.CutCopyMode = False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "teo410" wrote in message ... This is great but I need to INSERT not PASTE the rows in otherwise it pastes over other information. "Gary''s Student" wrote: Click on any cell in the row and run: Sub RowMaker() Dim r As Range, n As Long, nxtrow As Long, r2 As Range Set r = ActiveCell.EntireRow nxtrow = r.Row + 1 n = Application.InputBox(prompt:="How many rows", Type:=1) Set r2 = Range("A" & nxtrow & ":A" & nxtrow + n - 1) r.Copy r2 End Sub -- Gary''s Student - gsnu200860 "teo410" wrote: In my spreadsheet, I was wondering if I could set a macro to copy an entire row, ask me how many copies of the line I would like to make, and paste them underneath the original line. Any help would be greatly appriciated! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Inserting new lines with corresponding number | Excel Discussion (Misc queries) | |||
inserting new lines with number | Excel Discussion (Misc queries) | |||
inserting lines throughout a spreadsheet | Excel Worksheet Functions | |||
Inserting # of lines from one spreadsheet to another | Excel Discussion (Misc queries) | |||
Inserting Lines or Copying lines with formulas but without data | Excel Discussion (Misc queries) |