Results 1 to 5 of 5

Thread: Can excel read?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    4

    Question Can excel read?

    VB Code:
    1. Sub X()
    2.  
    3.  
    4. Set rng = Range("I18:L95")
    5.  
    6.  
    7. aydata = rng
    8. rng.ClearContents
    9.  
    10.  
    11. desrow = 1
    12.  
    13.  
    14. For i = LBound(aydata) To UBound(aydata)
    15.  
    16. If aydata(i, 3) <> 0 Then
    17.  
    18. For j = 1 To 3
    19. rng.Cells(desrow, j) = aydata(i, j)
    20. Next j
    21. If desrow / 15 = Int(desrow / 15) Then desrow = desrow + 1 Else desrow = desrow + 1
    22.  
    23. End If
    24.  
    25. Next i
    26.  
    27. End Sub

    This code deletes the values from the rows in a table with a blank in the third column and moves the values in the rows with a numeric value in the third column up to fill the spaces.

    For example:

    da-006 acrylic 20
    db-008 acrylic
    dc-012 acrylic 10

    Becomes...

    da-006 acrylic 20
    dc-012 acrylic 10

    Sometimes, in a seperate row, underneath the row with a blank or numeric value is a description.

    Is there anyway to keep the description if the above row remains but if the above row is deleted, the description would be too??

    For example:

    da-006 acrylic 20
    1. description...
    db-008 acrylic
    2. description....
    dc-012 acrylic 10

    Becomes...

    da-006 acrylic 20
    1. description...
    dc-012 acrylic 10

    The values of all the columns change depending on the job at hand, so does the description. The description is always longer than 10 characters, if that helps.

    Any idea how to accomplish this??

  2. #2
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Re: Can excel read?

    Why can you just delete the description when you delete the row? And if you dont delete the row skip over the description?

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Can excel read?

    Excel VBA question moved to Office Development

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    4

    Re: Can excel read?

    Right now the code I am using to erase the rows, automatically deletes the description..I'm not sure how to get excel to keep the description either way..

    But the tables get pretty lengthy and it would be best to have it done automatically..that is, if anyone out there has the solution..if not I will just have to make do...

    I'm stuck, I'm not sure how to get excel to decide that since the value (description) in column A is longer than 10 characters and the above row has a numeric value in column C, don't delete..but if the row above the description does not have a numeric value in column C, delete with the above row.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    4

    Re: Can excel read?

    Any ideas?

Posting Permissions

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



Click Here to Expand Forum to Full Width