Anthony's VBA Forum Index Anthony's VBA Forum
Where the knowledge is shared
Menu
 Anthony's VBA Forum IndexHome Page
 Anthony's VBA Forum IndexForum Index
FAQFAQ
MemberlistMemberlist
UsergroupsUsergroups
RegisterRegister
ProfileProfile
Log in to check your private messagesMessages
Log inLogin/Out

Quick Search

Advanced Search

Links
Consulting
Products

Who's Online
[ Administrator ]
[ Moderator ]


VBA Codes For EXCEL HELP GUYS

 
Post new topic   Reply to topic     Anthony's VBA Forum Index -> General Excel VBA
View previous topic :: View next topic  
Author Message
michilson



Joined: 20 Dec 2007
Posts: 1

PostPosted: Thu Dec 20, 2007 2:49 pm    Post subject: VBA Codes For EXCEL HELP GUYS Reply with quote

I need help with some coding for Excel. Heres what im looking to do and what i have so far.

I have created a userform to mark a reservation of a theater seat based on the text in a cell in a spread sheet (seat1.xls).

I want to also beable to apply and name and phone number from a seperate Execl (customers.xls) file to a corrisponding cell for the reservation.

I have a Userform in the customers file that allows me to enter information into the cells as a database would.

I have 3 text boxs on the seat1 form that i want to link to the customers data. (Phone Number, Last Name, First Name)

I also would like that in the Customers form if they enter a Phone number that already exists in the spreadsheet that it brings up all other corisponding data.

This is all writen in VBA

heres the coding to the customer form to place data in that spread sheet.

Private Sub Cmdsave_Click()
Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("Customers")

'find first empty row in database
irow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'check for a phone number
If Trim(Me.txtphone.Value) = "" Then
Me.txtphone.SetFocus
MsgBox "please Enter A Phone Number"
Exit Sub
End If

'copy data to the database

ws.Cells(irow, 1).Value = Me.txtphone.Value
ws.Cells(irow, 2).Value = Me.txtfirst.Value
ws.Cells(irow, 3).Value = Me.txtlast.Value
ws.Cells(irow, 4).Value = Me.txtaddress.Value
ws.Cells(irow, 5).Value = Me.txtcity.Value
ws.Cells(irow, 6).Value = Me.txtstate.Value
ws.Cells(irow, 7).Value = Me.txtzip.Value

'clear data
Me.txtphone.Value = ""
Me.txtfirst.Value = ""
Me.txtlast.Value = ""
Me.txtaddress.Value = ""
Me.txtcity.Value = ""
Me.txtstate.Value = ""
Me.txtzip.Value = ""

Please help me make this search for the corisponding data when the phone number is added to the txtphone text box.

and the coding i'll need to add the the seating form to come to the customer file and search the phone number for the first and last name and insert them into the correct text boxs.

If anyone would like to see the forms i can try to post a few screen shots
________
[URL=http://www.toyota-wiki.com/wiki/Subaru_EF_engine]Subaru EF engine history[/URL]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Anthony's VBA Forum Index -> General Excel VBA All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group