PDA

View Full Version : Solved: Unmerge target cell



av8tordude
07-28-2010, 10:34 AM
I created a form that has a few merged cells. The merged cells are used to enter a date. I'm using the code below to call the calendar...


If Not (Nothing Is Application.Intersect(Target, Range("M12,Q18,J20,Q22,P33,L39,P55"))) Then
Cancel = True
frmCalendar.show
End If


The range of cells in the code each have 3 cells merged (i.e. M12=(M12:O12)). I need to unmerge the cell, enter the date in one cell only, then merged the cell again without getting any messages.

can someone assist.

Simon Lloyd
07-28-2010, 10:57 AM
Like this:
Range("M12:O12").MergeCells = False
Range("M12").Value = "My Value"
Range("M12:O12").MergeCells = True

av8tordude
07-28-2010, 01:12 PM
Thank you for your help Simon, but I found a solution to my problem...


If Not (Nothing Is Application.Intersect(Target, Range("D18:D23, E13, G21:G23"))) Then
Cancel = True
With frmCalendar
If Target.MergeCells = True Then
rng = Left(Target.Address, Application.WorksheetFunction.Find(":", Target.Address) - 1)
If Len(Range(rng).Value) = 0 Then
.ThisDate = Date
Else
.ThisDate = Target.Select
End If
End If
.Show
Target.Value = .ThisDate
End With
End If