Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Fri, 2 Nov 2007 09:51:38 +0100, "Zlika" wrote:
Hi everybody, In my worksheet, the A1 cell is merged with the A2 cell (for example). My problem is that when I want to access to the value of the A2 cell (by typing "=A2" in another cell), it returns 0 instead of the value of the merged cell (which is in fact the value of the A1 cell). I know how to do in VBA (using .MergedArea.Cells(1,1) to access to the value of the first cell of the merged area) but not directly in an Excel formula (and I do not know in a general case that A1 and A2 are merged, so I cannot use "=A1"). Do someone know how to do it? Thank you very much Zlika I think you will have to use a UDF in your formulas in place of any cell reference which might be part of a merged area. The UDF can be pretty simple. e.g. ======================= Function mr(rg As Range) If rg.Count = 1 Then mr = rg.MergeArea(1, 1) Else mr = CVErr(xlErrRef) End If End Function ======================= The code above will give a REF error if rg is not a single cell. --ron |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula from a single cell to a merged cell | Excel Discussion (Misc queries) | |||
Autofit Merged cell Code is changing the format of my merged cells | Excel Discussion (Misc queries) | |||
how do i link merged cells to a merged cell in another worksheet. | Excel Worksheet Functions | |||
Formula to transfer text from merged cells to single cell? | Excel Discussion (Misc queries) | |||
formula to determine if cell is merged? | Excel Worksheet Functions |