Log in

View Full Version : Inserting a Row



The"Truth"
11-18-2008, 11:53 AM
Currently I have code written to go to the 1st avaliable row and insert the data from my user form. I am wanting to insert a row at the top of the page(Row 3 to be exact) and insert data there instead of going to the bottom and inserting data, is this possible? Below is an example of the current code.



Dim DataArray(1 To 1, 1 To 1) As Variant
Dim r As Integer

For r = 1 To 1

DataArray(r, 1) = LabelDate.Caption
Next

Sheets("Downtime Data").Activate
NextRow = Application.WorksheetFunction. _
CountA(Range("A:A")) + 1
Cells(NextRow, 1) = LabelDate.Caption

Bob Phillips
11-18-2008, 11:59 AM
Dim DataArray(1 To 1, 1 To 1) As Variant
Dim r As Integer

For r = 1 To 1

DataArray(r, 1) = LabelDate.Caption
Next

With Sheets("Downtime Data")

.Rows(3).Insert shift:=xlDown
.Range("A3").Value = LabelDate.Caption
End With