LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
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
 
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
Changing Cell Background Color based on data from another cell Speedy Excel Discussion (Misc queries) 2 March 16th 09 04:10 PM
Changing cell text color based on cell number W. Wheeler Excel Programming 0 April 22nd 07 11:56 PM
Changing a cells type based on it's value Keith Excel Worksheet Functions 2 April 18th 07 01:34 PM
Changing cell text color based on cell number scotty Excel Programming 9 April 14th 07 06:34 AM
Changing the color of a cell and adjacent cells based on conditions Matt[_42_] Excel Programming 2 September 6th 06 01:34 PM


All times are GMT +1. The time now is 12:20 PM.

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"