Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Unknown # cells need to be in one column - Macro

Somebody must be smarter than I ... that I know.

I have the following data in an excel sheet:
Columns
A B
JK 3
BK 1
PS 2

Where Column A is the names of employees, which has an unknown number
of rows and column B is the # of raffles they won - the number of
raffles they win changes. I am trying to write a macro that does this
.... put the number of raffles in column C in a row ...

C
JK
JK
JK
BK
PS
PS

Once this is done - i have a random number generator pick from this
list ....

Thanks a bunch - to the many of you smarter than I.

Excel 2003

Kenlyn T. Gretz

  #2   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default Unknown # cells need to be in one column - Macro

'-----------------------------------------------
Sub GenRandom()
Dim rSrc As Range
Dim rDest As Range
Dim iRpt As Integer

Set rDest = Range("C1")
For Each rSrc In Range( _
Range("A1"), _
Cells(Rows.Count, "A").End(xlUp))

For iRpt = 1 To rSrc.Offset(0, 1)
rDest.Value = rSrc.Value
Set rDest = rDest.Offset(1, 0)
Next iRpt
Next rSrc
End Sub

'-----------------------------------------------

HTH
--
AP

a écrit dans le message de news:
...
Somebody must be smarter than I ... that I know.

I have the following data in an excel sheet:
Columns
A B
JK 3
BK 1
PS 2

Where Column A is the names of employees, which has an unknown number
of rows and column B is the # of raffles they won - the number of
raffles they win changes. I am trying to write a macro that does this
... put the number of raffles in column C in a row ...

C
JK
JK
JK
BK
PS
PS

Once this is done - i have a random number generator pick from this
list ....

Thanks a bunch - to the many of you smarter than I.

Excel 2003

Kenlyn T. Gretz



  #3   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Unknown # cells need to be in one column - Macro

AP - awesome... you are much smarter than I... thanks a bunch.

Kenlyn

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
Finding and compiling list of cells containing data... Richard Walker Excel Worksheet Functions 6 March 18th 06 02:17 PM
Dynamic column insert (macro) Chris Excel Discussion (Misc queries) 2 March 15th 06 11:33 AM
Macro to change Chart Range when inserting a column Mark Charts and Charting in Excel 1 September 13th 05 01:12 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
Return Count for LAST NonBlank Cell in each Row Sam via OfficeKB.com Excel Worksheet Functions 12 April 17th 05 10:36 PM


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