ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loading information from a VBA project to spreadsheet (https://www.excelbanter.com/excel-programming/354554-loading-information-vba-project-spreadsheet.html)

Jerome[_5_]

Loading information from a VBA project to spreadsheet
 
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


Dave Peterson

Loading information from a VBA project to spreadsheet
 
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.



Jerome wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 09:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com