View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chrisso Chrisso is offline
external usenet poster
 
Posts: 110
Default Changing 2 cells based on another cell

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