VB scripts with excel?
I have created a spreadsheet for jobs that I am currently advertising, I would like to create a VB user form where I can enter the job details and it will insert them into the spreadsheet, into columns 1,2,3 and 5 They are named Ref – Job Title – Location – End Date I have created 4 text boxes to enter the data into and I have created a drop down list to select what sheet I want the data to be entered into. I have also created two buttons, one to enter the data and one to close the form. This is the code i have but it doesn’t work. I have got this code from a tutorial but it doesn’t seem to work as i have tried to change it to change it to meet my requirements. Please could you give me as much help as possible. Thanks in advance Jamie Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("Area1") 'find first empty row in database iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _ SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1 'check for a ref number' If Trim(Me.Ref.Value) = "" Then Me.Ref.SetFocus MsgBox "Please enter a part number" Exit Sub End If 'copy the data to the database ws.Cells(iRow, 1).Value = Me.Ref.Value ws.Cells(iRow, 2).Value = Me.JobTitle.Value ws.Cells(iRow, 3).Value = Me.Branch.Value ws.Cells(iRow, 5).Value = Me.EndDate.Value 'clear the data Me.Ref.Value = "" Me.JobTitle.Value = "" Me.Branch.Value = "" Me.EndDate.Value = "" Me.Ref.SetFocus End Sub
Asked By: Jamie Steadman - 9/14/2012
Best Answer - Chosen by Asker
The code seems valid. If your userform is showing, I don't see what the problem could be. You'd need to make sure the command button is named appropriately (cmdAdd) and that it is linked to the code you've inserted, and that its associated with the userform (double-click the cmdAdd button on your form in design mode).
Answered By: Blackened - 9/14/2012
Additional Answers (2)
The code refers for "Me." starting in line 9 of your code, but there is no definition of what "Me." is before that. Is that where the code is failing (line 9)?
Answered By: Doreen - 9/14/2012
In what way is it not working?
Answered By: FlashDarkness - 9/14/2012
$47/hour Part-Time Job Openings. Requirements: Must Have Computer.
Over 483 Local Jobs Now Hiring In Your Area. $18-$87/Hr - Apply Today!
Legitimate Survey for Cash.Extra Money for You,Join Here!
Jobs hiring now near your local area. Find a job and apply now.
Other Career Questions
Do most mechanical engineering jobs offer job security?
What is your current job? Why did you choose this job? What do you enjoy about your job? What do you dislike about your job? What would be your perfect job? Would you rather have this j...
Where are the jobs? Is productivity and globalization creating a permanent “recession” of jobs? My main issue is I am doing a paper for school and have no idea where to begin. I was hoping suggestions...
Content is not owned or controlled by Monster. Any content concerns should be addressed with Yahoo!
Yahoo! Does not evaluate or guarantee the accuracy of any Yahoo! Answers content. Yahoo! Disclaimer.
Best-Paying Work-from-Home Jobs
It’s easier than ever to work from home. Of course, not every job is a mobile job, and some companies aren’t interested in having their employees work from home.
2013 Marketing Jobs Outlook
The US may be facing another year of anemic hiring overall, but that won't be the case in the high-orbit world of multichannel, digital media marketing.
2013 Engineering Jobs Outlook
Engineers will find job opportunities in select disciplines in 2013, with candidates who are all-around, client-oriented businesspeople in demand.
Best-Paying Jobs by Major
What could you earn with a particular four-year degree? Find out by checking out this list of the top-paying jobs for 20 of the most common majors.
Eight High-Paying, Secure Jobs
Want to earn a good salary and enjoy a measure of job security as well? Check out these well-paying jobs on tap for fast growth in the coming years.