Thread: Add rows
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Add rows

This is all you need.

Sub Addrows_Click()
Dim iLastRow As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Cells(ActiveCell, "A").AutoFill Cells(ActiveCell, "A").Resize(2)

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Robert Hargreaves" wrote in message
...
yes bob but how do I fit it into my code?

I have tried as follows

Sub Addrows_Click()

Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

ActiveCell = Cells(Rows.Count, "A").End(xlUp).Row
Cells(ActiveCell, "A").AutoFill Cells(ActiveCell, "A").Resize(2)

End Sub

It doesnt work like this can you tell mewhy?

Thanks
Rob



"Bob Phillips" wrote in message
...

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
Cells(iLastRow,"A").Autofill Cells(iLastRow,"A").Resize(2)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Robert Hargreaves" wrote in message
...
I am trying to use code to find the next available empty row in a

column
(A)
and add amonths worth of days in rows and autofill the rows with

formula,
conditional formatting, pattern of increment in formaul, dates &

numbers
etc

The code I use at present is like this

Range("A1").Select

Do

If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True

--- This line i dont know how to do....

Range(ActiveCell:Activecell - 1).Autofill
Destination:=Range("ActiveCell:????)

Can you tell me how to add a month to the column in days based on the

entry
in the cell above the (ActiveCell).

If I can do this I can then I will be able to automate the deletion of

a
month of rows and addition of a month of rows to keep the spreadsheet
size
down.

Thanks for you help
Rob