Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can write code to do anything. If you are asking someone to write
the code for you then you may be disappointed. Psuedo code would be: * walk over every entry in your export extracting the room number * search for the room number in a lookup list on a seperate book/ sheet --- the lookup list has the correct room number to teacher mapping * when you find the room number row then lookup the correct teacher * enter this back into the export over the incorrect teacher * move down a row at a time and repeat * stop when there is no more data Here are some code stubs for some of these steps: Sub Find_Value(sValue As String) Dim rFinder As Range Set rFinder = YourSheet.Column(<ROOM NUMBER COLUMN).Find(sValue) if rFinder Is Nothing MsgBox sValue & " cannot be found." Else MsgBox sValue & " found on row " & rFinder.Row End If End Sub Sub Loop_Over_Data() Dim rCell As Range Set rCell = YourSheet.Cells(1, 1) Do While rCell.Value < vbNullString ' do something ==================== ' next row of data: Set rCell = rCell.Offset(1, 0) Loop End Sub Note: this wont compile until you replace "YourSheet" with a valid Worksheet object and "(<ROOM NUMBER COLUMN" with a column number Chrisso |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Changing Cell Background Color based on data from another cell | Excel Discussion (Misc queries) | |||
Changing cell text color based on cell number | Excel Programming | |||
Changing a cells type based on it's value | Excel Worksheet Functions | |||
Changing cell text color based on cell number | Excel Programming | |||
Changing the color of a cell and adjacent cells based on conditions | Excel Programming |