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

I read through my last post and it made no sense at all. Its kinda har
to explain so let me try again.

Here is the part numbers we are running with the number we need t
run.

25752599 = 3
25747753 = 2
25747755 = 1
25752597 = 3
25747761 = 0
25747763 = 3
25752595 = 2
25747769 = 0
25747771 = 2
25752602 = 1
25747741 = 0
25747749 = 1

The part numbers are in cells A4:A15 and the quanity are in cell
B4:B15.

Now A16 = 12 meaning team one has to build 12 of these.
And A17 = 6 meaning team two has to build 6 of these.

What I was wondering is if I could write something that would separat
these giving team one 12 of the 18 (listed in cells C4:C15) and tea
two 6 of the 18 (listed in cells D4:D15).

But the numbers in B4:B15 can change quantities. As can A16 and A17.

I hope this is possible, it will save me a lot of time.

-TyeJae

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Starting over

Try this - i assigned names team1 and team2 to your cells
a16 and a17

John

Option Explicit
Sub Macro1()
'
' Macro1 Macro
'
Dim team1goal As Integer
Dim team2goal As Integer
Dim team1total As Integer
Dim team2total As Integer
Dim i As Integer
team1goal = Range("team1").Value
team2goal = Range("team2").Value
team1total = 0
team2total = 0
For i = 4 To 15
If team1total = team1goal Then GoTo team2
If Cells(i, 2).Value + team1total < team1goal _
Then GoTo onlyteam1
team2total = Cells(i, 2).Value - _
(team1goal - team1total)
Cells(i, 3).Value = team1goal - team1total
Cells(i, 4).Value = Cells(i, 2).Value - _
Cells(i, 3).Value
team1total = team1goal
GoTo nexti
onlyteam1:
team1total = Cells(i, 2).Value + team1total
Cells(i, 3).Value = Cells(i, 2).Value
GoTo nexti
team2:
If team2total = team2goal Then GoTo done
If Cells(i, 2).Value + team2total < team2goal _
Then GoTo onlyteam2
Cells(i, 4).Value = team2goal - team2total
GoTo done
onlyteam2:
team2total = Cells(i, 2).Value + team2total
Cells(i, 4).Value = Cells(i, 2).Value
nexti:
Next i
done:
End Sub

-----Original Message-----
I read through my last post and it made no sense at all.

Its kinda hard
to explain so let me try again.

Here is the part numbers we are running with the number

we need to
run.

25752599 = 3
25747753 = 2
25747755 = 1
25752597 = 3
25747761 = 0
25747763 = 3
25752595 = 2
25747769 = 0
25747771 = 2
25752602 = 1
25747741 = 0
25747749 = 1

The part numbers are in cells A4:A15 and the quanity are

in cells
B4:B15.

Now A16 = 12 meaning team one has to build 12 of these.
And A17 = 6 meaning team two has to build 6 of these.

What I was wondering is if I could write something that

would separate
these giving team one 12 of the 18 (listed in cells

C4:C15) and team
two 6 of the 18 (listed in cells D4:D15).

But the numbers in B4:B15 can change quantities. As can

A16 and A17.

I hope this is possible, it will save me a lot of time.

-TyeJae-


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

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Starting over

I labeled A16 and A17 as team1 and team2 respectively. Then I copie
the code exatly as you put it and for some reason it isn't doin
anything.

Is there something else I should be doing?

-TyeJae

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Starting over


did you assign those range names to the cells?

cells b4-b15 has the # of each part?

a16 and a17 are the two totals?

maybe substitute a16 where team1 is and 17 where team2 is
if you are not sure of the range names

John

-----Original Message-----
I labeled A16 and A17 as team1 and team2 respectively.

Then I copied
the code exatly as you put it and for some reason it

isn't doing
anything.

Is there something else I should be doing?

-TyeJae-


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

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Starting over

Ok I got that to work, one small problem though, it does not evenl
distribute the part numbers. How could I do this? Thanks for you
help!

-TyeJae

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Starting over


Please explain more clearly what you want by "more evenly
distribute the part numbers".

John

-----Original Message-----
Ok I got that to work, one small problem though, it does

not evenly
distribute the part numbers. How could I do this?

Thanks for your
help!

-TyeJae-


---
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
starting macro again Davidm Excel Discussion (Misc queries) 3 June 3rd 09 04:12 AM
Starting with a zero? karyd Excel Discussion (Misc queries) 3 October 6th 08 04:28 AM
Postcodes starting with 0 fordrules01 Excel Discussion (Misc queries) 4 November 29th 06 08:32 AM
Starting Explorer from VBA Bob Phillips[_6_] Excel Programming 7 April 14th 04 05:00 AM
Starting a userform upon starting the file Fritznel Excel Programming 1 July 28th 03 05:37 AM


All times are GMT +1. The time now is 06:50 AM.

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"