View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
sek0910 sek0910 is offline
external usenet poster
 
Posts: 4
Default Make two colums from one column of data

Thanks..the first part works great, but the following line:

Rng.Offset(, 1).SpecialCells(xlCellTypeBlanks).EntireRow.Delete

appears to erase everything in the worksheet!

Once the values in the even numbered rows are moved to Column B of the odd
numbered rows, I just want to then delete all the even numbered rows and move
each lower row up so there will be no blank rows in the worksheet.

steve

"Norman Jones" wrote:

Hi Stephen,

'================
Public Sub Tester001()
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range
Dim LastRow As Long
Dim i As Long

Set WB = Workbooks("YourBook.xls") '<<===== CHANGE
Set SH = WB.Sheets("Sheet1") '<<===== CHANGE

LastRow = SH.Cells(Rows.Count, "A").End(xlUp).Row
Set Rng = SH.Range("A1:A" & LastRow)

Application.ScreenUpdating = False

For i = 1 To Rng.Rows.Count Step 2
Cells(i, 2).Value = Cells(i + 1, 1).Value
Next i

Rng.Offset(, 1).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Application.ScreenUpdating = False

End Sub
'<<================


---
Regards,
Norman


"sek0910" wrote in message
...
I have a column of numbers, the first being a date and the second a value,
etc..
I want to take every other value (the even numbered rows) and move them to
a
second column next to the date. Of course I'll end up with a blank every
other row, so I'll then want to "collapse" the columns to eliminate the
blanks.
Any easy way to do this as I have several thousand pieces of data.
Thanks in advance.,

Stephen