|
-
Jan 10th, 2006, 02:45 PM
#1
Thread Starter
New Member
Can excel read?
VB Code:
Sub X()
Set rng = Range("I18:L95")
aydata = rng
rng.ClearContents
desrow = 1
For i = LBound(aydata) To UBound(aydata)
If aydata(i, 3) <> 0 Then
For j = 1 To 3
rng.Cells(desrow, j) = aydata(i, j)
Next j
If desrow / 15 = Int(desrow / 15) Then desrow = desrow + 1 Else desrow = desrow + 1
End If
Next i
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??
-
Jan 10th, 2006, 02:56 PM
#2
Fanatic Member
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?
-
Jan 10th, 2006, 03:03 PM
#3
Re: Can excel read?
Excel VBA question moved to Office Development
-
Jan 10th, 2006, 05:39 PM
#4
Thread Starter
New Member
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.
-
Jan 11th, 2006, 02:51 PM
#5
Thread Starter
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|