La Web del Programador: Comunidad de Programadores
 
    Pregunta:  25767 - INERTAR UNA LINEA EN UNA HOJA DE EXCEL DESDE VISUAL BASIC
Autor:  Edward Pomatay
Por favor necesito ayuda de como insertar una linea es decir una fila en una hoja de Excel desde Visual quien me pudiera ayudar estaria muy agradecido

Gracias

  Respuesta:  Ronald León Madrid
Hola Edward :

aqui tengo un código que te puede ayudar. espero que te sirva.

Private Sub Command1_Click()
Dim xl As Excel.Application
Dim xlfile As String

Set xl = New Excel.Application
xlfile = "D:\Libro1.xls"
xl.Workbooks.Open xlfile
xl.Selection.EntireRow.Insert
xl.Visible = True
xl.Selection.Borders(xlDiagonalDown).LineStyle = xlNone
xl.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
xl.Selection.Borders(xlEdgeLeft).LineStyle = xlNone
xl.Selection.Borders(xlEdgeTop).LineStyle = xlNone
With xl.Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
xl.Selection.Borders(xlEdgeRight).LineStyle = xlNone

Set xl = Nothing

End Sub

Saludos.
Ronald León Madrid.