Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default copying deleting in excel vba code

I have a large amount of data numbering several thousand rows.
Unfortunately for example the data in row 2 needs to be concatenated to row
1, row 4 to row 3 and sow on. Once the data has been added to row 1 for
example from row 2, to tidy the data up I would want to delete row 2, the
same would apply to what was row 4, row 6 and so on. I have tried various
VBA codes but either end up deleting all of the data or end up in a
continuous loop that I can't break out of.

Any help would be appreciated.

thanks
--
neil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default copying deleting in excel vba code

Hi
Eg if you have one column, A (similar with multi columns):
- in B2: =IF(iseven(ROW()),A2&A3,"").
- copy / paste the formula down.
- copy column B (menu Edit Copy) .
- pasteSpecial as Value (menu Edit PasteSpecial, as Value) over B
itself.
- now select the autofilter : menu Data Filter AutoFilter
- for column B, in the autofilter , choose empty string value
-- only row with "" will show
- select these rows and delete

I hope this helps
Sebastien
"neil" wrote:

I have a large amount of data numbering several thousand rows.
Unfortunately for example the data in row 2 needs to be concatenated to row
1, row 4 to row 3 and sow on. Once the data has been added to row 1 for
example from row 2, to tidy the data up I would want to delete row 2, the
same would apply to what was row 4, row 6 and so on. I have tried various
VBA codes but either end up deleting all of the data or end up in a
continuous loop that I can't break out of.

Any help would be appreciated.

thanks
--
neil

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default copying deleting in excel vba code

To help, please give an example of the data. You mention "concatenated", but
then use the word "added". Is this text or numeric data? How many columns are
there?

Assuming text:

Dim LastRow As Long
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
NumColumns = 5

For R = 1 To LastRow Step 2
For C = 1 To NumColumns
Cells(R, C).Value = Cells(R, C).Value & Cells(R + 1, C).Value
Next C
Rows(R).Clear
Next R

Cells(1, 1).Resize(LastRow, NumColumns).Sort _
Key1:=Cells(1, 1), Order1:=xlAscending


On Wed, 9 Feb 2005 12:55:04 -0800, "neil"
wrote:

I have a large amount of data numbering several thousand rows.
Unfortunately for example the data in row 2 needs to be concatenated to row
1, row 4 to row 3 and sow on. Once the data has been added to row 1 for
example from row 2, to tidy the data up I would want to delete row 2, the
same would apply to what was row 4, row 6 and so on. I have tried various
VBA codes but either end up deleting all of the data or end up in a
continuous loop that I can't break out of.

Any help would be appreciated.

thanks


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
Deleting and Copying Marco code engbe Excel Discussion (Misc queries) 4 May 11th 08 02:44 AM
Copying data to excel and deleting duplicates Dom Excel Discussion (Misc queries) 2 January 3rd 08 10:25 AM
Deleting the area code on excel spread sheet phone numbers?? Ben Excel Discussion (Misc queries) 4 October 3rd 07 01:34 PM
Excel hard code those #'s without deleting the formula or typing# JudiS Excel Discussion (Misc queries) 1 August 1st 05 11:21 PM
Deleting code in a file with code.. KimberlyC Excel Programming 3 March 4th 04 09:24 PM


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