Add rows with macros in EXCEL without having to set a base row to generate the others

0

I made the following code in VBA (visual basic for application) in EXCEl so that through an associated MACRO, it can generate rows from "copy" a "base" row. The code that I have elaborated is the following:

Sub Afilacalcderegulacion()
  ActiveSheet.Unprotect "cyf"
  Dim i As Integer
  Dim CurrentSheet As Object
  i = 15
  While (Cells(i, 1) <> "")
  i = i + 1
  Wend

   Range("B" & i).EntireRow.Insert
  ActiveSheet.Protect "cyf"
End Sub

How can you realize, what I do not want is to have i = 15 there so that through the function rank can insert the row Since with this what happens is the following: Here I insert content in row 15, without using the add rows button.

Here when I use the macro button that inserts rows. As you can see, the text inserted in row B15 (the immediately after plant-transfer) is moved so many times, insert a row.

    
asked by Leonardo Sanchez 17.07.2017 в 19:33
source

0 answers