Loading information from a VBA project to spreadsheet

  • Thread starter Thread starter Jerome
  • Start date Start date
J

Jerome

Hi

I am new to VBA and was wondering if anyone could please help me with a

problem I have been encountering.


I am making a spreadsheet for my school's drama festival.It has a small

VBA program in it which shows the user a seating plan, which is placed
on a UserForm. He/she can double-click to book it, and the program
specifies if the person is to
be an adult or child. That 'seat' on the seating plan then changes
colour - red for adult, blue for child.


But now I want this information to be uploaded into the spreadsheet -
so on the spreadsheet it will say what seats/how many seats have been
booked. Can it see how many boxes are coloured red and blue, and then
also put on the info?


Could anyone help?


Thanks so much, Jerome
 
This may not work...

I think I'd create a worksheet (maybe hidden) that contains all the seat
id/locations in column A. Then I'd use column B to put in Adult/Child (via
code).

Since I don't have any idea how that userform works, this may not help.

After the booking agent(?) confirms the assignment (ok button?), the code would
look through that worksheet to find the correct seat and put Adult or Child in
column B (or clear the entry if the agent unassigned that seat).

dim mySeatId as string
dim mySeatTaker as string
dim res as variant
dim mySeatIdRng as range

with worksheets("seatIdlist")
set myseatidrng = .range("a2",.cells(.rows.count,"A").end(xlup))
end with

myseatid = me.combobox1.value 'or however you know the seat id.
myseattaker = 'whatever you do to put Adult/child/empty

res = application.match(myseatid,myseatidrng,0)

if iserror(res) then
'shouldn't happen
msgbox "design error--missing: " & myseatid
else
myseatidrng(res).offset(0,1).value = myseattaker
end if

========
Then you could just use
=countif()'s to count the adults, children, available.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top