Your "ENTER" code was going nowhere!
Set ws = Worksheets(Format(Date, "MMMYYYY"))
irow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
You must first define to which sheet and then to the first empty ROW.
like:
Define which sheet=
- Select Case MONTH
-
Case 1: WSNAME = "JAN2010"
-
Case 2: WSNAME = "FEB2010"
-
....
-
Activate it and go to the first empty row=
- WS.Activate
-
WS.Range("A1").End(xlDown).Offset(1, 0).Activate
PS:
I have changed the code for that part because it gives an error if there is no data entered yet or there is only 1 row entered.
So it must start at A1 and be:
- If WS.Name = WSNAME Then
-
WS.Activate
-
WS.Range("A1").End(xlDown).Offset(1, 0).Activate
-
With ActiveCell
-
.Value = txtpo
-
.Offset(0, 1) = txtname1
You see I also have still to learn a lot of things although I have started programming in 1975 (on a Texas TI94 with 12Kb RAM ) as a hobby but never have done it as a profession.
Although my jobs I have done were mostly with computers.
A good website with tutorials is:
http://www.theopensourcery.com/ostutor.htm#vba
with:
- Intro into Visual Basic
- The outline of the VB development Interface
- ...
http://www.vb6.us/guides/visual-basic-6-beginners-guide
with:
- Beginner Guide
- Controls Guide
- Database Guide
http://www.vbtutor.net/vbtutor.html
with:
- Introduction to Visual Basic 6
- Building VB Applications
- ...
Also You can Google for: "Ebook VB6 tutorial PDF"
The best thing to learn a programming language is always the practical way be solving real (industrial ) problems and also learning from other program codes.
But now back to our project=
- Must the name of the client be split into First and Last name ?
It gives us more programming (concatenate it for placing it in the listbox and splitting it again for searching it in the sheet) while maybe nobody is asking it for being splitted !
- Suggestions: always use the same name (or abbreviation of it) in the sheet, form, commands, ...( NOT OK: "First Name" = txtname1, ...)
Now we know its the same but after some months (and other projects) we (or someone else) will have to unravel the code before he understands the logic in the code.
- Also : use the names that the user of the program will us!
- Examine the data that must be entered: how long must the TEXTBOX be for a clear view of the data.
- Ask the user what the best layout is.(maybe for the ENTER form there is no need of a header with the name of the Firm, only on the reports and the printouts ??)
These are all points who must have an answer in the analysis.