Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am having a very had time making this work. I was given a modification to some code I have that will allow an inout box to appear asking for a value but the code will not copy the rows and formulas as I need them...Can someone please help me make this work? I am trying to get it to display the input box, then after a value is put in there, the rows and formulas will be copied to the next row...This modification does accept the input but it inserts a blank row then a row with the copied formulas instaed of however many rows stated with the formulas also copied and no blanks... Sub insertrowswithformulas() nrows = InputBox("How many rows") ActiveCell.Resize(nrows, 1).EntireRow.Insert With ActiveCell ...EntireRow.Insert Range(Cells(.Row - 2, "I"), Cells(.Row - 2, "AL")).Copy _ Cells(.Row - 1, "I") Range(Cells(.Row - 2, "B"), Cells(.Row - 2, "G")).Copy _ Cells(.Row - 1, "B") End With End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub insertrowswithformulas()
nrows = InputBox("How many rows") With ActiveCell .Resize(nrows, 1).EntireRow.Insert Range(Cells(.Row - nrows - 1, "I"), _ Cells(.Row - nrows - 1, "AL")).Copy _ Cells(.Row - nrows, "I").Resize(nrows) Range(Cells(.Row - nrows - 1, "B"), _ Cells(.Row - nrows - 1, "G")).Copy _ Cells(.Row - nrows, "B").Resize(nrows) End With End Sub -- Regards, Tom Ogilvy "Having A Hard Time" wrote in message ... Hi, I am having a very had time making this work. I was given a modification to some code I have that will allow an inout box to appear asking for a value but the code will not copy the rows and formulas as I need them...Can someone please help me make this work? I am trying to get it to display the input box, then after a value is put in there, the rows and formulas will be copied to the next row...This modification does accept the input but it inserts a blank row then a row with the copied formulas instaed of however many rows stated with the formulas also copied and no blanks... Sub insertrowswithformulas() nrows = InputBox("How many rows") ActiveCell.Resize(nrows, 1).EntireRow.Insert With ActiveCell ..EntireRow.Insert Range(Cells(.Row - 2, "I"), Cells(.Row - 2, "AL")).Copy _ Cells(.Row - 1, "I") Range(Cells(.Row - 2, "B"), Cells(.Row - 2, "G")).Copy _ Cells(.Row - 1, "B") End With End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to input pictures automatically based on cell input? | Excel Worksheet Functions | |||
Have user input converted to uppercase in same cell as input? | New Users to Excel | |||
How do I add input data in the input ranges in drop down boxes. | Excel Discussion (Misc queries) | |||
=SUMIF(Input!H2:H718,AZ19,Input!E2:E685)AND(IF | Excel Worksheet Functions | |||
CODE to select range based on User Input or Value of Input Field | Excel Programming |