ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Function won't return value in merged cells (https://www.excelbanter.com/excel-discussion-misc-queries/91091-function-wont-return-value-merged-cells.html)

Dr. Mike

Function won't return value in merged cells
 
I have a need for when deleting the formula within a cell, another
cell's value will appear as default. Following is a formula that
serves, and works well in a single, unmerged cell. However, it--not
anything else I have tried--works in a group of merged cells. Does
anyone have a suggestion, and even better, an adaption to this formula?

Private Sub Worksheet_Change(ByVal TargetCell As Range)

If Not Intersect(TargetCell, Range("L14:L14")) Is Nothing Then
If TargetCell = "" Then
TargetCell = "=Sheet1!O14"
End If
End If
End Sub

Thanks,

Dr. M


Don Guillett

Function won't return value in merged cells
 
I don't use merged cells very often but try using all the merged cells such
as
range("L14:x14")

--
Don Guillett
SalesAid Software

"Dr. Mike" wrote in message
oups.com...
I have a need for when deleting the formula within a cell, another
cell's value will appear as default. Following is a formula that
serves, and works well in a single, unmerged cell. However, it--not
anything else I have tried--works in a group of merged cells. Does
anyone have a suggestion, and even better, an adaption to this formula?

Private Sub Worksheet_Change(ByVal TargetCell As Range)

If Not Intersect(TargetCell, Range("L14:L14")) Is Nothing Then
If TargetCell = "" Then
TargetCell = "=Sheet1!O14"
End If
End If
End Sub

Thanks,

Dr. M




Bob Phillips

Function won't return value in merged cells
 
My simple test worked. What is happening with you?

--
HTH

Bob Phillips

(replace somewhere in email address with googlemail if mailing direct)

"Dr. Mike" wrote in message
oups.com...
I have a need for when deleting the formula within a cell, another
cell's value will appear as default. Following is a formula that
serves, and works well in a single, unmerged cell. However, it--not
anything else I have tried--works in a group of merged cells. Does
anyone have a suggestion, and even better, an adaption to this formula?

Private Sub Worksheet_Change(ByVal TargetCell As Range)

If Not Intersect(TargetCell, Range("L14:L14")) Is Nothing Then
If TargetCell = "" Then
TargetCell = "=Sheet1!O14"
End If
End If
End Sub

Thanks,

Dr. M




Rookie 1st class

Function won't return value in merged cells
 
Is it a named range? I've had similar problems there. Try renaming it with
only the leading cell, if that doesn't work try "RangeStart:RangeStop"
hth Lou

"Dr. Mike" wrote:

I have a need for when deleting the formula within a cell, another
cell's value will appear as default. Following is a formula that
serves, and works well in a single, unmerged cell. However, it--not
anything else I have tried--works in a group of merged cells. Does
anyone have a suggestion, and even better, an adaption to this formula?

Private Sub Worksheet_Change(ByVal TargetCell As Range)

If Not Intersect(TargetCell, Range("L14:L14")) Is Nothing Then
If TargetCell = "" Then
TargetCell = "=Sheet1!O14"
End If
End If
End Sub

Thanks,

Dr. M



Dr. Mike

Function won't return value in merged cells
 
The formula I posted works fine with single cells. However, what I am
trying to do is have the value of a single cell show within a single
selection of merged cells once I've deleted the contents of the merged
cells. What works for single cells doesn't seem to work for merged
cells. If you have a solution, I'm all ears. Regardless, thanks for
your effort.

Dr. M


Dr. Mike

Function won't return value in merged cells
 
Unfortunately, my project is limited in space and the text I'm trying
to bring to the merged cell also requires a text wrap. Anyway, thanks
for your response.

Dr. M



All times are GMT +1. The time now is 11:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com