Tried calculating the number of rows which works but when i add this into the macro above i get
Object doesn't support this property or method
any ideas?
Tried calculating the number of rows which works but when i add this into the macro above i get
Object doesn't support this property or method
any ideas?
I've got the following macros in the attached file
This worked once but now inserts one line when run againPHP Code:
Sub Count_rows_and_insert()
Dim i As Integer
endrow = Cells(ActiveSheet.UsedRange.Rows.Count + 1, ActiveCell.Column).End(xlUp).Row
Sheets("sheet2").Select
For i = 1 To endrow
Rows("2:2").Select
Selection.Insert shift:=xlDown, copyorigin:=xlFormatFromLeftOrAbove
Next i
End Sub
The one above again worked once but now only copies 5 rows.PHP Code:
Sub Select_Copy_Paste()
With ActiveSheet
.Range("C7", .Cells.SpecialCells(xlCellTypeLastCell)).Select
End With
Selection.Copy
Sheets("Sheet2").Select
Range("C3").Select
ActiveSheet.Paste
Columns.AutoFit
End Sub
What i'd like to be able to do is combine bothe macros to do the following
* count the number of used rows on sheet1
* insert the number of rows on sheet2
* select the used range on sheet1 and copy it to sheet2 where the first line was inserted.
Can anyone please point me in the right direction/help.
Many thanks
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks