Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to copy formula and paste into another
I found and successfully loaded the following code, but I must use the ENTER
key for it to be fully posted. Any idea? Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) n = Target.Row With Target ..Value = Excel.Range("D" & n).Formula End With SendKeys "{ENTER}", True End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to copy formula and paste into another
You need the SendKeys to get you out of cell edit. You can avoid this by
setting Cancel=True Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) Cancel = True n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With End Sub -- Gary''s Student - gsnu200856 "usmc-r70" wrote: I found and successfully loaded the following code, but I must use the ENTER key for it to be fully posted. Any idea? Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With SendKeys "{ENTER}", True End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to copy formula and paste into another
n = Target.Row
With Target ..Value = Excel.Range("D" & n).Formula End With Cancel = True If this post helps click Yes --------------- Jacob Skaria "usmc-r70" wrote: I found and successfully loaded the following code, but I must use the ENTER key for it to be fully posted. Any idea? Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With SendKeys "{ENTER}", True End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to copy formula and paste into another
Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As
Boolean) Dim n As Long n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With Target.Offset(1).Select End Sub regards r Il mio ultimo lavoro ... http://excelvba.altervista.org/blog/...ternative.html "usmc-r70" wrote: I found and successfully loaded the following code, but I must use the ENTER key for it to be fully posted. Any idea? Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With SendKeys "{ENTER}", True End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to copy formula and paste into another
That solution worked, thanks!
"Gary''s Student" wrote: You need the SendKeys to get you out of cell edit. You can avoid this by setting Cancel=True Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) Cancel = True n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With End Sub -- Gary''s Student - gsnu200856 "usmc-r70" wrote: I found and successfully loaded the following code, but I must use the ENTER key for it to be fully posted. Any idea? Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With SendKeys "{ENTER}", True End Sub |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to copy formula and paste into another
That worked as well! Amazing how many different approaches can result in the
same outcome! Thanks to you all from USMC in Iraq. "Jacob Skaria" wrote: n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With Cancel = True If this post helps click Yes --------------- Jacob Skaria "usmc-r70" wrote: I found and successfully loaded the following code, but I must use the ENTER key for it to be fully posted. Any idea? Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With SendKeys "{ENTER}", True End Sub |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to copy formula and paste into another
And to 'r', thanks for your quick response and effective code.
"r" wrote: Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) Dim n As Long n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With Target.Offset(1).Select End Sub regards r Il mio ultimo lavoro ... http://excelvba.altervista.org/blog/...ternative.html "usmc-r70" wrote: I found and successfully loaded the following code, but I must use the ENTER key for it to be fully posted. Any idea? Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With SendKeys "{ENTER}", True End Sub |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to copy formula and paste into another
Gary, If I wanted to limit where this code works, (i.e. Column D or a range
of cells) what would the code look like? "Gary''s Student" wrote: You need the SendKeys to get you out of cell edit. You can avoid this by setting Cancel=True Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) Cancel = True n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With End Sub -- Gary''s Student - gsnu200856 "usmc-r70" wrote: I found and successfully loaded the following code, but I must use the ENTER key for it to be fully posted. Any idea? Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With SendKeys "{ENTER}", True End Sub |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to copy formula and paste into another
Correction, limit code response to any column other than D.
"Gary''s Student" wrote: You need the SendKeys to get you out of cell edit. You can avoid this by setting Cancel=True Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) Cancel = True n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With End Sub -- Gary''s Student - gsnu200856 "usmc-r70" wrote: I found and successfully loaded the following code, but I must use the ENTER key for it to be fully posted. Any idea? Private Sub Worksheet_BeforeDoubleclick(ByVal Target As Range, Cancel As Boolean) n = Target.Row With Target .Value = Excel.Range("D" & n).Formula End With SendKeys "{ENTER}", True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formula/ Macro that will copy and paste | Excel Worksheet Functions | |||
I need formula help or create a macro to copy and paste value only | Excel Discussion (Misc queries) | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming | |||
Macro to Copy/Paste then Paste to Next Line | Excel Programming |