Consulting

Results 1 to 6 of 6

Thread: Macros in Excel

  1. #1
    VBAX Newbie
    Joined
    Aug 2011
    Posts
    2
    Location

    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?
    Attached Files Attached Files

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,098
    Location
    How is this spreadsheet currently prepared? Is it imported into Excel?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    VBAX Newbie
    Joined
    Aug 2011
    Posts
    2
    Location
    Hi
    The information is extracted from Oracle as a text file which is then converted to an excel file.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    [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]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,098
    Location
    Not bad Bob, but it leaves the value 12613 as a value below the data in column G.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    I figured that one untended item is not too big a chore to tidy up manually!
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •