The attached provides a possible solution. If you have any questionslet me know. Tom
On Tue, Apr 28, 2009 at 11:19 AM, Tom Jeffries <tjeff...@gmail.com> wrote: > The attached provides a possible solution...If you have any questions let > me know. > Tom > > On Tue, Apr 28, 2009 at 8:27 AM, ronnie <ronakparekh_...@hotmail.com>wrote: > >> >> I did this much coding and i am stuck out here can you help on how to >> approach from here. >> >> Sub seating() >> Dim inputrow As Integer >> Dim seatNum As Integer >> Dim seat As String >> Dim name As String >> inputrow = 3 >> >> Rowadd = Left(seatNum, 1) >> ColAdd = Right(seatNum, 1) >> >> Dim OutRow, OutCol As Integer >> OutRow = Rowadd + 2 >> OutCol = ColAdd + 1 >> >> 'Reads the row unitl empty cell found >> Do While IsEmpty(Cells(inputrow, 1)) = False >> inputrow = inputrow + 1 >> Loop >> >> >> > Your task is to write a small macro that converts the seat list into a >> > seat chart in table 2. >> > First, the names in table 1 are in Last_Name, First_Name format. You >> > need to convert them into First_name Last_name format to place in >> > table 2. To do this, you need to write a function called ConvertName >> > ( ) which reads in the names in table 1 and converts them into >> > First_Name Last_Name format (e.g. “Andris, Paul” will be converted >> > into “Paul Andris”). >> >> > Second, utilize the ConvertName( ) function, write the macro (sub >> > procedure) to loop through table 1 and place the names (First_Name >> > Last_Name. e.g. Paul Andris) into the corresponding cells in Table 2: >> > Seat Chart (e.g. “Paul Andris” must be written in cell “F3”). >> >> > Hint: >> > For the ConvertName( ) function. For each name in table 1, the last >> > name and first name are separated by a comma (“,”). Use appropriate >> > string functions to extract the first name and last name and switch >> > their order. See our in-class example file in week 11 for reference. >> >> > You can use the isempty() function to loop through the list. For each >> > person, use the left( ) and right( ) string functions to extract each >> > seat’s row and column addresses. Once you have got these two values, >> > you can match them with the corresponding cell address in table 2. >> > e.g. for Paul Andris, seat number 1a. 1 correspond to row 3 of the >> > worksheet, a correspond to column F (6) of the worksheet. Thus you >> > need to write the name Andris, Paul to cells(3,6). >> > Table 1: Seat list >> > Name Seat >> > ANDRIS, PAUL 1a >> > BONSHOCK, ERIC 1d >> > BOWERS, DANIELLE 2a >> > BRENIZE, CORY 2c >> > CLARK, CHELSEA 3d >> > GARMAN, JOANN 3c >> > HARTUNG, KEITH 4c >> > HARVEY, CHRISTOPHER 4b >> > MARTIN, RYAN 5a >> > MELLOTT, KRISTIN 6b >> > MENAPACE, RAYMOND 7d >> > MITCHELL, LAWRENCE 8a >> > MORAN, BRENDAN 9a >> > NEIL, NATHAN 5b >> > PAREKH, RONAK 6c >> > REUTER, CHRISTOPHER 9b >> > RINCK, ZACH 8d >> > SCHLUSSER, SHAWN 6a >> > SURKIN, JEFFREY 1c >> > WEEKS, ANDREA 2d >> > WITTE, JONATHON 3a >> > WOLFF, ADAM 9a >> >> > Row A B C D >> > 1 >> > 2 >> > 3 >> > 4 >> > 5 >> > 6 >> > 7 >> > 8 >> > 9 >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---
SeatChart.xls
Description: MS-Excel spreadsheet