+ Reply to Thread
Results 1 to 5 of 5

|| Macro in userform | Help ||

  1. #1
    Registered User
    Join Date
    04-18-2013
    Location
    Bristol, England
    MS-Off Ver
    Excel 2010
    Posts
    33

    Smile || Macro in userform | Help ||

    Hi all...

    Am trying to create a purchase order form, whereby users can add their own contact. I've created a userform for this, but already have an existing table of fields, so I think the error message is related to where the new field is trying to be entered.

    Included is full file, any help would be greatly appreciated!

    "
    Dim iRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("Sheet2")

    'find first empty row in database
    iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _ SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1"

    * ' find first empty... * is the error command.

    Regards :-)
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: || Macro in userform | Help ||

    A better way to find the last used row is
    LastRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
    Elegant Simplicity............. Not Always

  3. #3
    Registered User
    Join Date
    04-18-2013
    Location
    Bristol, England
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: || Macro in userform | Help ||

    thank you, added that in now getting Compile Error
    > "Method or data member not found"
    > ".Textbox_ad1"

    this is taken from;

    'copy the data to the database
    ws.Cells(iRow, 1).Value = Me.TextBox_company.Value
    ws.Cells(iRow, 2).Value = Me.Textbox_ad1.Value ******
    ws.Cells(iRow, 3).Value = Me.TextBox_ad2.Value
    ws.Cells(iRow, 4).Value = Me.TextBox_ad3.Value
    ws.Cells(iRow, 5).Value = Me.TextBox_ad4.Value
    ws.Cells(iRow, 6).Value = Me.TextBox_tele.Value
    ws.Cells(iRow, 7).Value = Me.TextBox_fax.Value
    ws.Cells(iRow, 8).Value = Me.TextBox_contact.Value
    ws.Cells(iRow, 9).Value = Me.TextBox_email.Value

    :-(

  4. #4
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: || Macro in userform | Help ||

    Problem with this line

    ws.Cells(iRow, 2).Value = Me.Textbox_ad1.Value ****** specifically the asterisks

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: || Macro in userform | Help ||

    the control is called Textbox1_ad1
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1