Here is the code you need. It assumes the second sheet is called "Sheet2".
I've tested it as far as I can and it works.
I've attached my working version for you.
Doggie
Sub MergeSomeCells()
Dim work As Single
work = Worksheets("sheet2").Cells(3, 2).Value * 2
workrange = "A1:" + NumberToColumn(work) + "1"
ActiveCell.Range(workrange).MergeCells = True
End Sub
Function NumberToColumn(ByVal column As Long) As String
'Converts a number (1-255) to a column ("A" - "IV")
If column > 26 Then
NumberToColumn = Chr(Asc("A") + (column / 26) - 1) + Chr(Asc("A") + (column Mod 26) - 1)
Else
NumberToColumn = Chr(Asc("A") + column - 1)
End If
End Function