Hi,
Please read the forum rules and in particular the ruke about wrapping code lines inside CODE tags. I have done it for you on this occasion as this is your first post.
Original post......
Hello,
I want to copy rows from one sheet to another sheet, but this number of rows is different every time. Also the first row to select is not always the same. I want to use an input box in which the user can enter a number. This number needs to be used to determine which rows have to be copied according to this formula:
first row to copy = 2*Number + 8
last row to copy = 4*Number + 9
I created this macro but it doesn't work. What am I doing wrong?
Sub inputbox()
Sheets("Sheet1").Activate
Dim Number As Integer
Set Number = Application.inputbox( _
prompt:="Enter number", Type:=1)
Sheets("Sheet1").Select
Rows("8+2*Number:9+2*Number").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste
End Sub
Thanks a lot.
Bookmarks