Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,616
- Office Version
- 365
- 2016
- Platform
- Windows
With reference to this code:
The line in red is giving me an "Application-defined or object-defined error". The line is part of a process to lock a merged cell. (Yeah ... merged cells. Avoid them. In my application though, the funtionality depends on a range being merged.)
Is anyone able to identify my error?
Rich (BB code):
Sub blks_setup()
Dim ws_blocks As Worksheet
Dim rng_src As Range
Dim rng_dest As Range
Dim mergeRange As Range
mbevents = False
Set ws_blocks = ActiveWorkbook.Worksheets("Blocks")
Set rng_dest = ws_form.Range("G8")
If rcode Like "D*" Then
Set rng_src = ws_blocks.Range("A1:T5")
ws_form.Unprotect
With rng_dest
.Validation.Delete
.Cells.UnMerge
.ClearContents
End With
rng_src.Copy _
Destination:=rng_dest
With ws_form
With .Range("K8:L8") ', K9:L9, K10:L10, K11:L11, K12:L12, Q8:R8, Q9:R9, Q10:R10, Q11:R11, Q12:R12, T9:Z12")
If .MergeCells = True Then
Set mergeRange = .MergeArea
mergeRange.Locked = True
End If
End With
End With
Else
MsgBox "Error: Block options"
Stop
End If
End Sub
The line in red is giving me an "Application-defined or object-defined error". The line is part of a process to lock a merged cell. (Yeah ... merged cells. Avoid them. In my application though, the funtionality depends on a range being merged.)
Is anyone able to identify my error?