Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is this possible?
Ok I am going to try to explain this the best I can...here goes.
All things being equal between my two areas the formula I have work great because it separates everything fairly equally, but the problem am having is sometimes the data for each area is not equal fo example: On the Sheet called Prod Plan cell G50 tells how many racks 1st i scheduled for and cell G51 tells how many racks 2nd is scheduled for. Sometimes these are not equal. Like if we are scheduled 12 rack sometimes 1st has 9 and 2nd only has 3. I have 12 different par numbers and the formula below would separate any number of racks b part part numbers in the schedule for that day, but separates equally. Is there a way I can have this separate the racks by how many 1st ha compared to 2nd? I hope this makes sense. If not maybe I can explain further wha doesnt make sense. Private Sub Worksheet_SelectionChange(ByVal Target As Range) For x = 6 To 53 If Cells(x, 3).Value = 0 Then Range(Cells(x, 13), Cells(x, 32)).Value = "-" End If Next x Dim a As Boolean a = False For x = 6 To 53 If Cells(x, 3).Value = 1 And a = False Then Range(Cells(x, 13), Cells(x, 13)).Value = "1" Range(Cells(x, 14), Cells(x, 32)).Value = "-" a = True ElseIf Cells(x, 3).Value = 1 And a = True Then Range(Cells(x, 13), Cells(x, 22)).Value = "-" Range(Cells(x, 23), Cells(x, 23)).Value = "1" Range(Cells(x, 24), Cells(x, 32)).Value = "-" a = False End If Next x For x = 6 To 53 If Cells(x, 3).Value = 2 Then Range(Cells(x, 13), Cells(x, 13)).Value = "1" Range(Cells(x, 14), Cells(x, 22)).Value = "-" Range(Cells(x, 23), Cells(x, 23)).Value = "1" Range(Cells(x, 24), Cells(x, 32)).Value = "-" End If Next -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is this possible?
Tye,
Not sure what you are saying, but here's a code to look at. Charles Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim a As Boolean Dim x As Integer a = False For x = 6 To 53 If Cells(x, 3).Value = 0 Then Range(Cells(x, 13), Cells(x, 32)).Value = "-" ElseIf Cells(x, 3).Value = 1 And a = False Then Range(Cells(x, 13), Cells(x, 13)).Value = "1" Range(Cells(x, 14), Cells(x, 32)).Value = "-" a = True ElseIf Cells(x, 3).Value = 1 And a = True Then Range(Cells(x, 13), Cells(x, 22)).Value = "-" Range(Cells(x, 23), Cells(x, 23)).Value = "1" Range(Cells(x, 24), Cells(x, 32)).Value = "-" a = False ElseIf Cells(x, 3).Value = 2 Then Range(Cells(x, 13), Cells(x, 13)).Value = "1" Range(Cells(x, 14), Cells(x, 22)).Value = "-" Range(Cells(x, 23), Cells(x, 23)).Value = "1" Range(Cells(x, 24), Cells(x, 32)).Value = "-" End If Next x End Su -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|