Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Fill down relating to cell value

Good afternoon all!

I have a problem which i'm sure some of you will find easy in Excel!
I have a large two column sheet with a part number and a quantity. What
i need to do is repeat/fill down the part number refering to the qty,
ie:

123456 x 2
234567 x 3

would be

123456
123456
234567
234567
234567

Please help - the limitations of my labelling software are really
getting to me!


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Fill down relating to cell value

Try this macro.
Sub FillDown()

'Pre cond: Part number in column A and qty in column B.
' Single data can't exist in cells of col A and B
i.e. Data present in both An and Bn or nothing present in
both
'Post cond: Results put in col D

Dim i, j, k As Integer

i = 0
j = 0
Do While Range("B1").Offset(i, 0) < vbNullString
For k = 1 To Val(Range("B1").Offset(i, 0))
Range("D1").Offset(j, 0).Value = Range
("A1").Offset(i, 0).Value
j = j + 1
Next k
i = i + 1
Loop

End Sub

-----Original Message-----
Good afternoon all!

I have a problem which i'm sure some of you will find

easy in Excel!
I have a large two column sheet with a part number and a

quantity. What
i need to do is repeat/fill down the part number refering

to the qty,
ie:

123456 x 2
234567 x 3

would be

123456
123456
234567
234567
234567

Please help - the limitations of my labelling software

are really
getting to me!


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Fill down relating to cell value

Thanks Gandei

I have tried to run the macro as you suggest, but get a 'compile error
argument not optional' on 'value = range".

Any ideas would be appreciated!

Thanks in advance

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Fill down relating to cell value

Hi

Modify Gandei's code like this.
(It's a problem with News Group) :D


Code:
--------------------

Range("D1").Offset(j, 0).Value = _
Range("A1").Offset(i, 0).Value

--------------------


And what I suggest is as follows.


Code:
--------------------

Sub Test()
'Part number is placed in A col, Qty is placed in B col
Dim c As Range, i As Long
For Each c In Range([A1], [A65536].End(xlUp))
c.Offset(i, 2).Resize(c.Offset(, 1).Value).Value = c.Value
i = i + c.Offset(, 1).Value - 1
Next
End Sub

--------------------



---
Message posted from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Fill down relating to cell value

Fantastic Colo!

Works perfectly!

Have a nice evening

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Fill down relating to cell value

Fantastic Colo!

Works perfectly!

Have a nice evening

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Fill down relating to cell value

Fantastic Colo!

Works perfectly!

Have a nice evening

--
Message posted from http://www.ExcelForum.com

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Fill down relating to cell value

Fantastic Colo!

Works perfectly!

Have a nice evening

--
Message posted from http://www.ExcelForum.com

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
remove fill in text from a cell from an unpopulated fill-in cell Deb[_3_] Excel Worksheet Functions 1 September 22nd 09 03:28 PM
Max (A1:A1), relating to other cells Mark Solesbury Excel Worksheet Functions 2 March 30th 07 04:27 PM
Relating cells PaulinaDi Excel Worksheet Functions 3 October 17th 06 08:44 PM
Relating fields Henk Excel Discussion (Misc queries) 1 May 29th 06 11:33 AM
total value relating to cell values in multiple columns! via135 Excel Discussion (Misc queries) 3 January 25th 06 06:43 PM


All times are GMT +1. The time now is 05:54 AM.

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"