0
I would like to know how to copy a set of lines. For example, line 1 through 5 and paste on lines 10 through 15. This action would be done with the value 1 in 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 on 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 is 28 days or 29.
I have a formula FIMMÊS
to give me the exact day if the month ends 28 or 29 depending on the year.
If from one year to the next the month has one more day, the VBA adds a certain number of lines in the sheet "February" (just below the last row filled) or removes if the following year only has 28 again.
Thanks for the answer, but I’m not able to put this example into practice. I don’t know much about vba. The first code I put where? The If code is to enter something?
– elynoy