Skipping Blanks (Again)

  • Thread starter F. Lawrence Kulchar
  • Start date
F

F. Lawrence Kulchar

I wish to copy 2 columns of numbers as follows:

A B
1 100
2 50
3 85
4
5
6 10
7 15
9 10
10 20 20
11 16



The PASTED TO cells will appear as follows:

A B
1 100 85
2 50 10
3 15 10
4 20 20
5 16


In other words, all occupied cells are filled in from top to bottom,
skipping all blanks.

How is this accomplished?

Thanks,

FLKulchar
 
B

Bob Phillips

Public Sub ProcessData()
Dim i As Long, j As Long
Dim LastRow As Long

With ActiveSheet

For j = 1 To 2

LastRow = .Cells(.Rows.Count, j).End(xlUp).Row
For i = LastRow To 2 Step -1

If .Cells(i - 1, j).Value = "" Then

.Cells(i - 1, j).Value = .Cells(i, j).Value
.Cells(i - 1, j).Delete shift:=xlUp
End If
Next i
Next j
End With

End Sub

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
F

FLKulchar

I thought of this..however, in comes another problem...my blank cells are
not "blank" at all...there exists a formula where the value is "",
ergo...NOT 'blank' per se.

I performed a space special wherein I pasted values ONLY, but to no avail...

Any more suggestions, please??

Thanks,

FLKulchar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top