Hello,
I have written a HUGE macro to import a RTF file and adjust colunms etc, but what I am now looking to do is traverse this spreadsheet, and append the content of certains cells to the cell above, then delete the orignal cell, till the end of the data is reached.
I Done part of that( however ugly it may look ), but I'm having trouble getting it to loop till the end of the file (which can be / is a variable length ).
This is the code I have so far, which stops after the first "find". If I try and launch it again, it just add as blank space onto the end of the previous append, and stops in the same position
Sub findblankmovetoleft()
Dim R As Range
Dim All_Data As Range
Set All_Data = Range("a:a")
For Each R In All_Data
If R = "" Then
R.Select
Selection.Offset(0, 1).Select
ActiveCell = Selection.Offset(-1, 0) + " " + ActiveCell
Selection.Offset(-1, 0) = ""
ActiveCell.Cut
ActiveCell.Offset(-1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(2, -1).Select
If ActiveCell = "" Then
Selection.Offset(1, -1).Select
End If
Exit For
End If
Next R
End Sub
Any ideas as to what I can do to recifiy this ?
Many Thanks in advance
Gerald
I have written a HUGE macro to import a RTF file and adjust colunms etc, but what I am now looking to do is traverse this spreadsheet, and append the content of certains cells to the cell above, then delete the orignal cell, till the end of the data is reached.
I Done part of that( however ugly it may look ), but I'm having trouble getting it to loop till the end of the file (which can be / is a variable length ).
This is the code I have so far, which stops after the first "find". If I try and launch it again, it just add as blank space onto the end of the previous append, and stops in the same position
Sub findblankmovetoleft()
Dim R As Range
Dim All_Data As Range
Set All_Data = Range("a:a")
For Each R In All_Data
If R = "" Then
R.Select
Selection.Offset(0, 1).Select
ActiveCell = Selection.Offset(-1, 0) + " " + ActiveCell
Selection.Offset(-1, 0) = ""
ActiveCell.Cut
ActiveCell.Offset(-1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(2, -1).Select
If ActiveCell = "" Then
Selection.Offset(1, -1).Select
End If
Exit For
End If
Next R
End Sub
Any ideas as to what I can do to recifiy this ?
Many Thanks in advance
Gerald