View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] matthew.newsome@npower.com is offline
external usenet poster
 
Posts: 6
Default Adding a new row

On 1 Feb, 14:57, "Dave Miller" wrote:
Matt,

You could set the values of A1 (=A2) and B1 (=B3) to equal the values
on your form. I would then hide that row, and just copy rows("1:1")
every time.

To copy from one workbook to another, try this:

With Windows("OtherWorkbookName.xls").Sheets("Sheet B")
lRow = UBound(.UsedRange.Value) + 1
.Rows(lRow & ":" & lRow).Insert
End With

David Miller


Thanks again David, brilliant about the issue of copying the row, that
works a treat.

With regards to opening another workbook it doesn't seem to be working
can you have a look for me:-

Sub Button6_Click()
Dim lRow As Long
Sheets("Sheet A").Rows("1:1").Copy
With Windows("Book4.xls").Sheets("Sheet B")
lRow = UBound(.UsedRange.Value) + 1
.Rows(lRow & ":" & lRow).Insert
Application.CutCopyMode = False
End With
End Sub

I get an runtime error 9 ?. Am I missing something.