Hi,
I have a afew columns of data related to eachother. Column A contains text in some cells then afew blank cells then another cell with text etc.
I would like to merge the text cells with all the blank cells below it (until the next non-empty cell is reached).
However, I dont know the code to 'find next non-empty cell'
Here's my code so far:
Ive tried different combinations of the '[!""]' and none of them work. can anyone suggest code that would work?
Also how to you get it to 'merge and centre'?
And does anyone know if I save this workbook as a .CSV file whether it will still contain the merged cells when opened somewhere else?
Any help would be appreciated, Thanks
I have a afew columns of data related to eachother. Column A contains text in some cells then afew blank cells then another cell with text etc.
I would like to merge the text cells with all the blank cells below it (until the next non-empty cell is reached).
However, I dont know the code to 'find next non-empty cell'
Here's my code so far:
Code:
Dim startfrom As Long
Dim Merge1 As Long
Dim Merge2 As Long
startfrom = 1
Do
Merge1 = Range("A" & startfrom & ":A" & LastRow).Find("").Row - 1
Merge2 = Range("A" & Merge1 & ":A" & LastRow).Find([!""]).Row 'error here
Range("A" & Merge1 & ":A" & Merge2 - 1).Merge
startfrom = Merge2
Loop Until Range("A" & LastRow) Is Not Nothing 'error probably here aswell
Ive tried different combinations of the '[!""]' and none of them work. can anyone suggest code that would work?
Also how to you get it to 'merge and centre'?
And does anyone know if I save this workbook as a .CSV file whether it will still contain the merged cells when opened somewhere else?
Any help would be appreciated, Thanks