I would like to know how I can copy a set of lines. For example, line 1 through 5 and paste in lines 10 through 15. This action would be done with value 1 on another sheet and in cell A1.
I have a button with VBA to do this, but I wanted to do it automatically when the cell value is "28" or "29".
These are the codes I have button. One adds and the other removes the lines.
Private Sub CommandButton1_Click()
Sheets("Fevereiro").Rows("5:9").Copy (Sheets("Fevereiro").Rows("11:15"))
End Sub
Private Sub CommandButton2_Click()
Worksheets("Fevereiro").Rows("11:15").Delete
End Sub
This is to try to do the following:
The month of February now has 28 days or 29.
I have a FIMMÊS
formula to give me the exact day if the month ends on 28 or 29 depending on the year.
If from one year to another the month has one more day, VBA adds a certain number of rows in the "February" sheet (just below the last row filled in) or removes if the next year is only 28 again.