SirSquiddly
New Member
- Joined
- Jun 26, 2018
- Messages
- 40
Hi,
I have a code that I need help with adjusting as it almost does what I want it to do. I have added a button that quickly adds x amount of new rows from row 5 downwards. The issue is, I want them to be blank but still contain dropdowns and formula.
The code I have is below, but I am unsure how to extend the range to copy my entire row, (A-Z), I also require it to clear only certain cells,
I have a code that I need help with adjusting as it almost does what I want it to do. I have added a button that quickly adds x amount of new rows from row 5 downwards. The issue is, I want them to be blank but still contain dropdowns and formula.
The code I have is below, but I am unsure how to extend the range to copy my entire row, (A-Z), I also require it to clear only certain cells,
I have formula in columns I,J,K,L,Q,R,V,W,X. Is there a way the new row can keep the formula?It would leave the row blank if I cleared the non-formula cells only. A - H, M - P, S, T, U, Y, Z
Lastly, once I click and enter number for 9 rows, a pop-up box appears to open file from a different sheet from where one of the formula is linked to. Can this be stopped?
Any help greatly appreciated
Sub AddRows()
Dim x As Integer
x = InputBox("How many rows would you like to add?", "Insert Rows")
'Selecting range to insert new cells
Range(Cells(5, 1), Cells(x + 4, 1)).EntireRow.Insert
'Copys current cell A6 and past in the new cells
Cells(x + 5, 1).Copy Range(Cells(5, 1), Cells(x + 4, 1))
'if you want the cells to be blank but still have the drop down options
Range(Cells(5, 1), Cells(x + 4, 1)).ClearContents
End Sub
Lastly, once I click and enter number for 9 rows, a pop-up box appears to open file from a different sheet from where one of the formula is linked to. Can this be stopped?
Any help greatly appreciated
Sub AddRows()
Dim x As Integer
x = InputBox("How many rows would you like to add?", "Insert Rows")
'Selecting range to insert new cells
Range(Cells(5, 1), Cells(x + 4, 1)).EntireRow.Insert
'Copys current cell A6 and past in the new cells
Cells(x + 5, 1).Copy Range(Cells(5, 1), Cells(x + 4, 1))
'if you want the cells to be blank but still have the drop down options
Range(Cells(5, 1), Cells(x + 4, 1)).ClearContents
End Sub