Re: Selecting cells and merging, with VBA

  • Hi, I'm relatively new to using VBA and am having a similar problem. I want to select a range of cells and merge it but I am getting the Runtime error 1004 as well. here's my code:

    Dim LastRow As Long, x As Integer, y As Integer
    LastRow = Range("AF" & Rows.Count).End(xlUp).Row
        x = LastRow + 2
    Range("P" & x).Offset(0, 2).Select
    y = ActiveCell.Row
    Range("S" & y).Select
    Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(0, 5)).Merge
  • Re: Selecting cells and merging, with VBA

    Assuming mtSh is a worksheet, try...

    Dim x As Long
        With Worksheets("mtSH")
            x = .Range("AF" & .Rows.Count).End(xlUp).Row + 2
            With .Range("S" & x, "S" & x + 5)
            End With
        End With

    If I've been helpful, let me know. If I haven't, let me know that too. 

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!