-
1 Attachment(s)
Macros in Excel
Hi,
I am new to this forum and very new to Macros.
I really need some assitance with a spreadsheet that i use on a monthly basis.
I have attached a sample of this sheet and upon perusing you will notice that each entry occupies up to 5 rows.
Can Macros help me to get the entries into 1 Row?
-
How is this spreadsheet currently prepared? Is it imported into Excel?
-
Hi
The information is extracted from Oracle as a text file which is then converted to an excel file.
-
[vba]
Public Sub ProcessData()
Dim Lastrow As Long
Dim Lastcol As Long
Dim i As Long, j As Long
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet
Lastrow = .Cells(.Rows.Count, "B").End(xlUp).Row
Lastcol = .Range("A1").End(xlToRight).Column
For i = Lastrow To 3 Step -1
If Cells(i, "A").Value2 = "" Then
For j = 2 To Lastcol
If .Cells(i, j).Value <> "" Then
.Cells(i - 1, j).Value = .Cells(i - 1, j).Value & " " & .Cells(i, j).Value
End If
Next j
.Rows(i).Delete
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
[/vba]
-
Not bad Bob, but it leaves the value 12613 as a value below the data in column G.
-
I figured that one untended item is not too big a chore to tidy up manually!