LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default continue to move data until all moved

One way:-

Sub MoveData()

Dim r As Long
Dim lrow As Long

Application.ScreenUpdating = False

lrow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
For r = lrow To 1 Step -1
With Cells(r, 1)
If Left(.Value, 9) = "statusmsg" Then
.Offset(, 1).Value = .Value
.ClearContents
End If

End With
Next r

Application.ScreenUpdating = True

End Sub



--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"eadie" wrote in message
m...
Hi all,

ok, I have sheet of data in the following format:

A B

id1: thisisid1
id2: thisisid2
id3: thisisid3
id4: thisisid4
status:
statusmsg1
statusmsg2
statusmsg3
statusmsg4
statusmsg5
statusmsg6
statusmsg7
id1: thisisid1
id2: thisisid2
id3: thisisid3
id4: thisisid4
status:
statusmsg1
statusmsg2
etc... etc...continues in the same format...

what i need to do is move the status messages from column a to column
b...
so it should look like the following:

A B

id1: thisisid1
id2: thisisid2
id3: thisisid3
id4: thisisid4
status:
statusmsg1
statusmsg2
statusmsg3
statusmsg4
statusmsg5
statusmsg6
statusmsg7
id1: thisisid1
id2: thisisid2
id3: thisisid3
id4: thisisid4
status:
statusmsg1
statusmsg2
etc....etc....

now I currently have the following code, it and it moves the first lot
over, how do i get it to loop and get it to continue moving them over
until they have all been moved?

Sub move_status()

Cells.Find(What:="status:", After:=ActiveCell, LookIn:=xlFormulas,
_
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
Range(Worksheets(1).Cells(6, 1), Worksheets(1).Cells(12,
1)).Activate
Selection.Cut
Range(Worksheets(1).Cells(6, 2), Worksheets(1).Cells(12,
2)).Activate
ActiveSheet.Paste

End Sub


any ideas??

many thanks,

eadie



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date: 02/01/2004


 
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
Referencing a cell even if its contents are moved moved/replaced Darren Excel Discussion (Misc queries) 7 May 22nd 10 08:43 PM
can I write an Excel macro to pause for data entry then continue? kiwiwaldo Excel Discussion (Misc queries) 3 June 30th 08 10:25 AM
Continue Formula if Data is Available Dvinechild Excel Discussion (Misc queries) 5 February 26th 08 10:42 PM
Can you pause a macro in excel to input data and continue? Hutch Excel Discussion (Misc queries) 1 May 5th 06 06:16 PM
Data Continue to next column? Drew Excel Discussion (Misc queries) 1 January 8th 05 09:43 PM


All times are GMT +1. The time now is 05:14 PM.

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

About Us

"It's about Microsoft Excel"