Need help with VB code

Russk68

Active Member
Joined
May 1, 2006
Messages
466
Hi All
Michael M (thank you) wrote the original code for me and I'm trying to make a change

I want to replace a deleted formula in column C when I double click in a cell. (See formula below)

If Not Intersect(Target, Range("c:c")) Is Nothing Then
Target.Formula = "=IF(BS$2=""Fixture Type"",CL" & ActiveCell.Row & ,IF(BS$2=""Fixture Type+(DMXFP)"",CJ" & ActiveCell.Row & ))"
Target.Offset(1, 0).Select
End If

This is the result I am looking for if I double click in C3.
=IF(BS$2="Fixture Type",CL3,IF(BS$2="Fixture Type+(DMXFP)",CJ3))

When I click in C4, I need column Cl and CJ to be relative (CL4 and CJ4)

Thank you
Russ
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
44,464
Office Version
365
Platform
Windows
See if this does what you want

Rich (BB code):
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  If Not Intersect(Target, Range("c:c")) Is Nothing Then
    Cancel = True
    Target.Formula = "=IF(BS$2=""Fixture Type"",CL" & ActiveCell.Row & ",IF(BS$2=""Fixture Type+(DMXFP)"",CJ" & ActiveCell.Row & "))"
  End If
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,096,241
Messages
5,449,199
Members
405,556
Latest member
dougbohr

This Week's Hot Topics

Top