Double click copy

  • Thread starter Thread starter dzelnio
  • Start date Start date
D

dzelnio

I would like a worksheet that does this:

1. When I double click A4
2. Text from A1 automatically is entered into A4.

Seems like a formula I need.

I use Excel 2004 for Mac.

Help please!
dzelnio
 
Not tested on a Mac but for 2003.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target _
As Range, Cancel As Boolean)
With Me.Range("A4")
.Value = Range("A1").Value
End With
Cancel = True
End Sub


Gord Dibben MS Excel MVP
 
I should have been more specific. If it was a formula then the
ranges A4 and A1 would follow depending on the row (i.e. double click
B5 and the value for B1 appears in that cel). I believe this locks me
into only these two cels.

'
 
Specifics are generally the best option<g>

I'm still not sure what you need.

You have changed from A to B and also the offset has changed.

Maybe this code?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target _
As Range, Cancel As Boolean)
Const myRange As String = "A5:IV5"
On Error GoTo enditall
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(myRange)) Is Nothing Then
Target.Value = Target.Offset(-4, 0).Value
End If
Cancel = True
enditall:
Application.EnableEvents = True
End Sub


Gord
 
Back
Top