LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default VBA Range select

Hi,

I am a VB newbie.

I have imported some data from a text file - each row of data being 12
columns wide, with circa 40000 rows.
Unfortunately one of the fields in the text file contained a carriage return
for some of the info, resulting in some of the information spilling over to
2 lines - one of four columns wide, the second line being 8 wide, though
with the second row starting in the column B.

A B C D E F G H I J K L
Number Period Date Qty Cost/Unit Status Cost Ledger Bill rate
NoChargeDate BilledQty ActualStart
W138831 4 05/04/2005 7 700 Costed 4900 1100 700 00/00/00 7 13:00
W138831 4 05/04/2005 16.5 700 Costed 11550 1100 700 16.5 09:00
W138830 4 06/04/2005 10.5
700 Costed 7350 700 00/00/00 10.5 09:00
W138829 4 06/04/2005 10.5 700 Costed 11550 1100 700 00/00/00 16.5
09:00
W138779 4 04/04/2005 2 700 Costed 11550 1100 700 00/00/00 16.5 09:00
W138778 4 05/04/2005 9
700 Reconciled 6300 1100 700 9 09:00
W138777 4 05/04/2005 10 700 Costed 11550 1100 700 16.5 09:00


I am trying to write a macro that will :
1. move down column A until such time as it reaches a blank cell
2. then offset down 1 row and across 1 column [column B] - (i.e the start of
the info that has been shifted onto a second row)
3. select from column B across the 8 columns that are on the wrong line
(though some of the columns might be blank so I can't use -
"End(xlToRight)")
4. cut selection, offset up one row and across to column E and paste the 8
columns
5. offset down 1 row, "End(xlToLeft)" to get back to column A
6. delete the now blank row
7. move down column A until such time as it reaches the next blank cell

then loop the above until such time as all the faulty lines have been pieced
together again with all the resulting blank rows deleted.

Thanks in advance

Craig


 
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
How can change range to select active rows instead of :=Range("S10 ldiaz Excel Discussion (Misc queries) 7 August 29th 08 03:52 PM
I can't select a range in VBA bigjim Excel Discussion (Misc queries) 4 April 12th 08 12:43 AM
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
I cannot select a range Kassie Excel Discussion (Misc queries) 3 February 21st 05 06:09 AM
Select Sheet then Select Range Gee[_2_] Excel Programming 3 May 27th 04 10:10 PM


All times are GMT +1. The time now is 11:41 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"