Data Entry Form

JIGYANSHA1985
StarLounger
Posts: 77
Joined: 15 Jan 2011, 02:32

Data Entry Form

Post by JIGYANSHA1985 »

Sir,

Will you please help me in providing User Form Entry Screen samples in excel ...

Thanks

Jigyansha

User avatar
HansV
Administrator
Posts: 78500
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Data Entry Form

Post by HansV »

It would be beyond the scope of this forum to write all the code for a userform for you, but if you have specific questions we will be happy to help you.
Best wishes,
Hans

JIGYANSHA1985
StarLounger
Posts: 77
Joined: 15 Jan 2011, 02:32

Re: Data Entry Form

Post by JIGYANSHA1985 »

Sir,
Will you please guide me in showing a few code not complete ... So that I'll try the rest ....
Regards
Jigyansha

User avatar
HansV
Administrator
Posts: 78500
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Data Entry Form

Post by HansV »

Please tell us what the form is supposed to do.
Best wishes,
Hans

JIGYANSHA1985
StarLounger
Posts: 77
Joined: 15 Jan 2011, 02:32

Re: Data Entry Form

Post by JIGYANSHA1985 »

Sir,

I need a macro which shall only add records one by one. A few sample datas are also given. When the next record added it shall place at the end of the previos record. Different columns are there in the excel sheet, like wise datas are to be placed / punched through this user form. In that attached excel sheet I have only created list box, command button and so on. But as I am not acquianted with VB, I am not able to do it. Sir, Pl. do the entry portion only, no need to spend valuable time in doing Edit & Find portion. Part-1 & Part-2 of the screen are only required for storing data. If values are punched in the user form they shall be reflected in their corresponding excel cells. It will be a great help towards me if you will provide me one sample.

Regards
Jigyansha

User avatar
HansV
Administrator
Posts: 78500
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Data Entry Form

Post by HansV »

Here is part of the code for the Add Records button (CommandButton1); you'll have to complete it yourself:

Code: Select all

Private Sub CommandButton1_Click()
  Dim r As Long
  If Not IsDate(Me.TextBox1) Then
    Me.TextBox1.SetFocus
    MsgBox "Please enter a valid date.", vbExclamation
    Exit Sub
  End If
  r = Range("A" & Rows.Count).End(xlUp).Row + 1
  Range("A" & r) = CDate(Me.TextBox1) ' use CDate for date values
  Range("B" & r) = Me.TextBox24
  Range("C" & r) = Me.TextBox25
  ' and so on, until
  Range("AC" & r) = Me.TextBox23
End Sub
Remark: it would be better to give the controls on the userform meaningful names. For example, you could rename CommandButton1 to cmdAddRecord, TextBox1 to txtDemandDt, TextBox24 to txtBran, etc. This would make the code more readable:

Code: Select all

Private Sub cmdAddRecords_Click()
  Dim r As Long
  If Not IsDate(Me.txtDemandDt) Then
    Me.txtDemandDt.SetFocus
    MsgBox "Please enter a valid date.", vbExclamation
    Exit Sub
  End If
  r = Range("A" & Rows.Count).End(xlUp).Row + 1
  Range("A" & r) = CDate(Me.txtDemandDt) ' use CDate for date values
  Range("B" & r) = Me.txtBran
  ...
  ...
When you read this version, it is clear what the controls are used for.
Best wishes,
Hans

JIGYANSHA1985
StarLounger
Posts: 77
Joined: 15 Jan 2011, 02:32

Re: Data Entry Form

Post by JIGYANSHA1985 »

Thanks for spending so much time with me.... May I know Sir, Where are you exactly from ?

User avatar
HansV
Administrator
Posts: 78500
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Data Entry Form

Post by HansV »

As you can see below my user picture, I'm from The Netherlands (also known as Holland).
Best wishes,
Hans

tfspry
NewLounger
Posts: 3
Joined: 09 Jun 2010, 19:39
Location: USA

Re: Data Entry Form

Post by tfspry »

Hello Jigyansha - Have you tried a simple Data>Form for a solution? Do you have a sample file to upload? VB may not be needed.

steveh
SilverLounger
Posts: 1952
Joined: 26 Jan 2010, 12:46
Location: Nr. Heathrow Airport

Re: Data Entry Form

Post by steveh »

JIGYANSHA1985 wrote:Sir,

Will you please help me in providing User Form Entry Screen samples in excel ...

Thanks

Jigyansha
Hi Jigyansha

Although I still have to ask loads of questions here I found that by downloading the example workbook found here http://www.exceltip.com/st/Create_User_ ... l/629.html" onclick="window.open(this.href);return false; and reading the instructions helped a lot. If you Google you can find many examples but try the Contextures website as there are some other good examples there
Steve
http://www.freightpro-uk.com" onclick="window.open(this.href);return false;
“Tell me and I forget, teach me and I may remember, involve me and I learn.”
― Benjamin Franklin

JIGYANSHA1985
StarLounger
Posts: 77
Joined: 15 Jan 2011, 02:32

Re: Data Entry Form

Post by JIGYANSHA1985 »

Thanks Sir ...