Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Moving Cells

I have 3,000 rows in my worksheet. I just want to move
every other row up one line:

Smith, John (cell A1)
Biology Dept (cell A2)

I want to move cell A2 to B1...and

Jones, Sam (cell A3)
Anesth Dept (cell A4)

I want to move cell A4 to B3..and so on throughout my
worksheet. Thanks for the code in advance.

DaveB
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Moving Cells

Hi
see your other posting
P.S.: please don't multipost

--
Regards
Frank Kabel
Frankfurt, Germany


DaveB wrote:
I have 3,000 rows in my worksheet. I just want to move
every other row up one line:

Smith, John (cell A1)
Biology Dept (cell A2)

I want to move cell A2 to B1...and

Jones, Sam (cell A3)
Anesth Dept (cell A4)

I want to move cell A4 to B3..and so on throughout my
worksheet. Thanks for the code in advance.

DaveB

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Moving Cells

Hi Dave,

A simple macro

Sub MoveEm()
Dim i As Long
Dim cLastRow As Long
Dim rng As Range

Application.ScreenUpdating = False
cLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Cells(1, "B").Value = Cells(2, "A").Value
Set rng = Range("A2")
For i = 3 To cLastRow Step 2
Cells(i, "B").Value = Cells(i + 1, "A").Value
Set rng = Union(rng, Cells(i + 1, "A"))
Next i
rng.EntireRow.Delete
Application.ScreenUpdating = True

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"DaveB" wrote in message
...
I have 3,000 rows in my worksheet. I just want to move
every other row up one line:

Smith, John (cell A1)
Biology Dept (cell A2)

I want to move cell A2 to B1...and

Jones, Sam (cell A3)
Anesth Dept (cell A4)

I want to move cell A4 to B3..and so on throughout my
worksheet. Thanks for the code in advance.

DaveB



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving text around cells without moving boarder lines Dale Excel Discussion (Misc queries) 1 December 15th 09 06:14 PM
Enter Key + Dragging Cells / Moving Cells Tim Excel Discussion (Misc queries) 2 September 24th 08 11:14 AM
Arrow Keys Moving Window Frame instead of Moving Between Cells nemmex Excel Discussion (Misc queries) 2 April 9th 07 09:08 AM
Moving between cells Bails Excel Discussion (Misc queries) 5 July 7th 06 06:00 PM
moving cells Youdish Excel Worksheet Functions 1 February 16th 06 06:45 PM


All times are GMT +1. The time now is 08:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"