User Profile
Rodrigo_
Steel Contributor
Joined 3 years ago
User Widgets
Recent Discussions
Formula (VBA generated) fills the entire column of selected cell
Hello everyone I'm currently experiencing an issue with my Excel (365). The code is supposed to insert a formula into a cell when I double-click it, but it fills the entire column of the selected cell with the formula. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim r As Integer If Not Intersect(Target, Me.Range("F3:R65")) Is Nothing And IsEmpty(Target.Value) Then r = Target.Row Target.Formula = "=IF($C" & r & ">$D" & r & ",$D" & r & "+1-$C" & r & ",$D" & r & "-$C" & r & ")" Cancel = True End If End Sub Before: After (Double-clicked cell I15):440Views0likes3Comments