Hi,
each time I try to apply template format with data from access I receive this message: Runtime error '1004' Cannot change part of a merged cell
and it points to this line:
and this is the complete section of the code:Code:ActiveSheet.Range(Cells(x, y), Cells(x + Int(c / 50), y + 6)).Clear
How to fix it, please?Code:'********************************************************************* '* INPUT top left cell of the merge '* INPUT "[ROWS]#[COLUMNS]" offset to be merged (void = 0) '********************************************************************* Public Sub str_merge(row, col, instructions) Dim x, y As Integer Dim q As Variant q = Split(instructions, "#") y = q(UBound(q)) If Not q(0) = "" Then x = q(0) ActiveSheet.Range(Cells(row, col), Cells(row + x, col + y)).MergeCells = True End Sub Public Function memo_merge(x, y, c) ActiveSheet.Range(Cells(x, y), Cells(x + Int(c / 50), y + 6)).Clear ActiveSheet.Range(Cells(x, y), Cells(x + Int(c / 50), y + 6)).Interior.color = RGB(255, 255, 255) ActiveSheet.Range(Cells(x, y), Cells(x + Int(c / 50), y + 6)).Borders.LineStyle = True ActiveSheet.Range(Cells(x, y), Cells(x + Int(c / 50), y + 6)).MergeCells = True memo_merge = x + Int(c / 50) End Function
Best Regards




Reply With Quote