PROJECT: Workorder Database

I'm trying to write some code for a simple database and am needing some of your VALUABLE help. I know very little about VBA and will be learning this as I go, please be patient.

I'd really like to do this in 'baby steps'. Thanks

I've formatted a spreadsheet for the data to be collected, it looks like a form.
Just some cells with data, i.e. name, address... (actually several sheets of data)

I want to take the data from the form and have a button append it to the next empty row of a different sheet (this sheet will be in a different file eventually).

I think I'll be using some type of automated copy/paste from there (somewhat done, it did work, now doesn't).

Please remember 'baby steps'.

If someone already has some code that would be fine, if not then...



Here's some code I wrote,

The button was on the 'database' sheet and worked well(?).
When I cut and pasted the button to my 'form' it stopped working.

It is giving me an error at 'Go to DB and Selects first empty row' selecting cell a4. I tried skipping that line, it gives me an error on all 'range' lines. I tried the 'activate sheet' but still does not work.



THANKS IN ADVANCE, Phil



Private Sub AddWO_Click()

'After data is entered on form, select cell a1:
    Sheets("Call Form").Select
    Range("A1").Select
    
    
    
'Go to DB and Selects first empty row
    Sheets("DataBase").Select
    Range("a4").End(xlDown).Select            'this did work, now it doesn't
    Selection.End(xlDown).Select               'tried other ways, but no good
    ActiveCell.Offset(1, 0).Select               'thanks for your help



'add the next WO#
    ActiveCell.FormulaR1C1 = "=R[-1]+1"



'add 'date of entry' (one cell to the right of WO#)
    ActiveCell.Offset(0, 1).Select
    Dim Today
    Today = Now    ' Assign current system date and time.
    ActiveCell.Formula = Today



'add data from FORMS to DB
    Range("A1").Select
    Sheets("Call Form").Select
    Worksheets("Call Form").Range("L3:W3").Copy
    Sheets("DataBase").Select
    Range("A1").Select
    Selection.End(xlDown).Select
    Selection.End(xlDown).Select
    ActiveCell.Offset(0, 2).Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    Range("A1").Select
    Application.CutCopyMode = False
    ActiveWorkbook.Save
End Sub



History

12/03/07
....what statement is used to select the next empty row?

I've tried the 'end(xldown)' it gives me the last used row.

.......Used 'activecell.offset' THANKS to marcos