Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default "Smart" Copy

My set of data looks like this:

VendorNbr Amount
1000 $900
$750
$500
1120 $600
1500 $700
$800

I want the data in a more "tabular" format, so I'm hoping to copy each
vendor number down to the next populated cell, and repeat the process all the
way down (about 9,000 rows). Doing this the manually for 9,000 rows isn't a
real option. Is there some code that could automate this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default "Smart" Copy

http://j-walk.com/ss/excel/usertips/tip040.htm
Duplicate repeated entries in a list

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Kirk P."
wrote in message...
My set of data looks like this:

VendorNbr Amount
1000 $900
$750
$500
1120 $600
1500 $700
$800

I want the data in a more "tabular" format, so I'm hoping to copy each
vendor number down to the next populated cell, and repeat the process all the
way down (about 9,000 rows). Doing this the manually for 9,000 rows isn't a
real option. Is there some code that could automate this?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default "Smart" Copy

You could do it in code but there is a quick way to do it without coding.

Will assume your Vendor Nbr is in column A of your worksheet (YourSheet) and
has a column header in row 1.
Use another column - could be on the same sheet or another worksheet, even
another workbook. Just temporary anyway. I will use column C in this
example. In the 2nd row of this column put this formula:
=IF(A2="",C1,A2)
Use Autofill or Copy/Paste to duplicate this for the entire column. That
should fill in the proper numbers. Then copy the results, and use Paste
Special... Values to replace column A. Now you can delete the temporary
column.
--
- K Dales


"Kirk P." wrote:

My set of data looks like this:

VendorNbr Amount
1000 $900
$750
$500
1120 $600
1500 $700
$800

I want the data in a more "tabular" format, so I'm hoping to copy each
vendor number down to the next populated cell, and repeat the process all the
way down (about 9,000 rows). Doing this the manually for 9,000 rows isn't a
real option. Is there some code that could automate this?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default "Smart" Copy

Hi,


Sub copyDown()
Worksheets("sheet1").Select ' <==== change as required
With Worksheets("sheet1")
lastrow = .Cells(Rows.Count, "B").End(xlUp).Row
For r = 3 To lastrow
If .Cells(r, "A") = "" Then .Cells(r, "A") = .Cells(r - 1, "A")
Next r
End With
End Sub

"Kirk P." wrote:

My set of data looks like this:

VendorNbr Amount
1000 $900
$750
$500
1120 $600
1500 $700
$800

I want the data in a more "tabular" format, so I'm hoping to copy each
vendor number down to the next populated cell, and repeat the process all the
way down (about 9,000 rows). Doing this the manually for 9,000 rows isn't a
real option. Is there some code that could automate this?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default "Smart" Copy

Works great. Thanks!

"K Dales" wrote:

You could do it in code but there is a quick way to do it without coding.

Will assume your Vendor Nbr is in column A of your worksheet (YourSheet) and
has a column header in row 1.
Use another column - could be on the same sheet or another worksheet, even
another workbook. Just temporary anyway. I will use column C in this
example. In the 2nd row of this column put this formula:
=IF(A2="",C1,A2)
Use Autofill or Copy/Paste to duplicate this for the entire column. That
should fill in the proper numbers. Then copy the results, and use Paste
Special... Values to replace column A. Now you can delete the temporary
column.
--
- K Dales


"Kirk P." wrote:

My set of data looks like this:

VendorNbr Amount
1000 $900
$750
$500
1120 $600
1500 $700
$800

I want the data in a more "tabular" format, so I'm hoping to copy each
vendor number down to the next populated cell, and repeat the process all the
way down (about 9,000 rows). Doing this the manually for 9,000 rows isn't a
real option. Is there some code that could automate this?

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
Selecting "Save As" adds "Copy of" to file name- MS Excel 2007 ronhansen Excel Discussion (Misc queries) 1 November 15th 09 09:33 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
Can you "duplicate" "copy" listboxes and code to multiple cells? HotRod Excel Programming 1 September 1st 04 05:03 PM
Question about "smart" text comparing TBA[_2_] Excel Programming 0 January 23rd 04 02:19 AM


All times are GMT +1. The time now is 02:06 PM.

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"