Results 1 to 5 of 5

VBA - UserForm error

Threaded View

asd456 VBA - UserForm error 06-26-2018, 11:10 AM
Arkadi Re: VBA - UserForm error 06-26-2018, 11:37 AM
Arkadi Re: VBA - UserForm error 06-27-2018, 07:26 AM
asd456 Re: VBA - UserForm error 07-31-2018, 09:33 AM
Arkadi Re: VBA - UserForm error 07-31-2018, 10:35 AM
  1. #1
    Registered User
    Join Date
    03-15-2018
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    4

    VBA - UserForm error

    Hi,

    This is screencapture of a simple userform I have created:

    ScreenHunter 20180626 Image 004.jpg

    I want the data for txtName, txtID, txtEmailAddress and txtMobileNumber to be added to LastRow +1 of wsDatabase

    This is the code I have written for the command button "Add New":

    Private Sub cmdAddNew_Click()

    Dim LastCell As Range
    Dim txtName, txtEmailAddress As String
    Dim txtID, txtMobileNumber As Long

    Set LastCell = wsDatabase.Cells(Rows.Count, 1).End(xlUp)

    With LastCell

    .Offset(1, 0) = txtName
    .Offset(1, 1) = txtID
    .Offset(1, 2) = txtEmailAddress
    .Offset(1, 3) = txtMobileNumber

    End With

    End Sub

    After running the macro, this is the result (only Column D is updated with "0", Columns A to C not updated)

    ScreenHunter 20180626 Image 008.jpg

    Can I ask what am I not doing right? Thank you.
    Last edited by asd456; 06-26-2018 at 11:27 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Error trying to import userform into Outlook: Unable to load UserForm.FRX
    By jeffclanders in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2016, 12:36 PM
  2. Userform error
    By Jessica.Bush in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-14-2010, 01:29 AM
  3. VBA Userform error
    By bobo6429 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-12-2009, 10:13 AM
  4. Error in userform when error in worksheet
    By sepandb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2008, 10:43 AM
  5. Error with userform
    By Josh_123456 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-08-2007, 06:17 PM
  6. [SOLVED] error in userform
    By damorrison in forum Excel General
    Replies: 6
    Last Post: 04-23-2006, 10:25 AM
  7. [SOLVED] userform error
    By reuben in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2005, 06:20 PM

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