Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Tidy up data

I've been given a spreadsheet which I have to tidy up each day, which
hopefully with your help this could be automated??

Each line is made up like the following:
A B C
Row (Odd Number) Always "object:" Data 1
Row (Even Number) Unique Number * Data 2

What I want to be able to do is combine the data together from row 2
within row 1, e.g.

Data from even number rows will be added on from column D onwards
Is this possible through VBA?

Many thanks for your help with this, Al.

)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Tidy up data

Yes it is possible Al.

Where do you want the result? On a new sheet.

Does the data start on Row 1?

--
Regards,
Tom Ogilvy


"Al Mackay" wrote in message
om...
I've been given a spreadsheet which I have to tidy up each day, which
hopefully with your help this could be automated??

Each line is made up like the following:
A B C
Row (Odd Number) Always "object:" Data 1
Row (Even Number) Unique Number * Data 2

What I want to be able to do is combine the data together from row 2
within row 1, e.g.

Data from even number rows will be added on from column D onwards
Is this possible through VBA?

Many thanks for your help with this, Al.

)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Tidy up data

Sub CopyData()
Dim lastRow as long, i as Long
Dim sh as Worksheet
Set sh = Worksheets("Sheet2") ' destination sheet
Dim rw as Long
rw = 1
lastRow = Cells(rows.count,1).End(xlup).Row
for i = 1 to lastRow - 1 Step 2
cells(i,1).Resize(1,3).copy Destination:=Sh.Cells(rw,1)
cells(i+1,1).Resize(1,10).copy Destination:=sh.Cells(rw,4)
rw = rw + 1
Next
End Sub

Change 10 to the number of columns that you want copied from the even rows.

If you don't want to start at column A, then change the individual 1 in
cells(i+1,1) to indicate which column to start copying from.

the sheet with the original data should be the activesheet when you run the
macro.
--
Regards,
Tom Ogilvy


"Al Mackay" wrote in message
om...
Hi Tom

Thanks for replying to this - in answer to your questions.

Where do you want the result? On a new sheet.
- On a new sheet would be preferable.
Does the data start on Row 1?
- The data does start in Row 1.

Thanks Tom, Al.

(Al Mackay) wrote in message

. com...
I've been given a spreadsheet which I have to tidy up each day, which
hopefully with your help this could be automated??

Each line is made up like the following:
A B C
Row (Odd Number) Always "object:" Data 1
Row (Even Number) Unique Number * Data 2

What I want to be able to do is combine the data together from row 2
within row 1, e.g.

Data from even number rows will be added on from column D onwards
Is this possible through VBA?

Many thanks for your help with this, Al.

)



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
Macro to tidy data dapouch Excel Discussion (Misc queries) 4 October 6th 09 10:21 AM
Tidy up multiple find and replace code PSM[_10_] Excel Worksheet Functions 2 April 6th 09 02:00 PM
Tidy lookup PBcorn Excel Worksheet Functions 2 June 18th 08 08:05 AM
Tidy Up Pete Excel Discussion (Misc queries) 4 May 9th 05 05:09 PM
Tidy up macro! Gareth[_3_] Excel Programming 3 September 18th 03 06:48 PM


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