View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] geofferrington@hotmail.com is offline
external usenet poster
 
Posts: 25
Default To duplicate a row

The indicated part of the following code needs to be modified in such a
way that the row of the double clicked cell is duplicated for editing.
There are no formulae involved. The new row is to be inserted directly
below the active cell.

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
On Error GoTo err_handler
With Target
If Not Intersect(Target, Range("N2:N6")) Is Nothing Then
If Not IsEmpty(.Value) Then
ThisWorkbook.FollowHyperlink ThisWorkbook.Path _
& "\" & .Value
End If
End If
'------------------ This is the code of interest ------------------
If .Row 8 Then
Range(Cells(ActiveCell.Row, "A"), _
Cells(ActiveCell.Row, "Z")).Insert xlDown
Range("B" & ActiveCell.Row).Select
On Error GoTo 0
End If
'-----------------------------------------------------------------------------
End With
Exit Sub

err_handler:
MsgBox "An error has been made" & vbCrLf _
& "File name not recognised.", _
vbExclamation, "Error Notice"
End Sub


All suggestions gratefully received.

Geoff