Hi all
Hope someone can help.
Been using excel for years but very very new to VBA. Ive managed to record macros, but thats about the extent of my knowledge.
Can I ask? Is there any code that will enable me to ask a user for a range of blank cells to merge. Here is what I have so far....
As you can see I can get it to loop a user defined number of times, but it would be nice to be able to change the number of cells being merged.
Any help would be much appreciated.
Thanks
Simon
Hope someone can help.
Been using excel for years but very very new to VBA. Ive managed to record macros, but thats about the extent of my knowledge.
Can I ask? Is there any code that will enable me to ask a user for a range of blank cells to merge. Here is what I have so far....
VBA Code:
Dim lp As Integer
Dim loops As Integer
loops = InputBox("Enter Number of Loops")
Do
ActiveCell.Offset(0, 0).range("A1:A12").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
ActiveCell.Offset(1, 0).range("A1").Select
lp = lp + 1
Loop Until lp = loops
As you can see I can get it to loop a user defined number of times, but it would be nice to be able to change the number of cells being merged.
Any help would be much appreciated.
Thanks
Simon
Last edited by a moderator: