Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using a form to input data into a schedule

Hello to all:

I'm quite new to VBA and was working on a form to input data into a
schedule. I am updating certain fields within the schedule as others
have formulas based on the input. Not sure if I've approached it in
the correct manner but I cannot get the second data entry to go to the
next row below for each field. Please find the code that I used below:

Private Sub CommandButton1_Click()

Worksheets("Schedule").Activate
Dim Port As Object

Set Port = Worksheets("Schedule").Range("B7")
Port.Value = TextBox1.Text
ActiveCell.Offset(1, 0).Range("B7").Select

Dim ESOP As Object

Set ESOP = Worksheets("Schedule").Range("E7")
ESOP.Value = TextBox2.Text
ActiveCell.Offset(1, 0).Range("E7").Select

Dim Cargo As Object

Set C argo = Worksheets("Schedule").Range("H7")
Cargo.Value = TextBox3.Text
ActiveCell.Offset(1, 0).Range("H7").Select

Dim Prod As Object

Set Prod = Worksheets("Schedule").Range("I7")
Prod.Value = TextBox4.Text
ActiveCell.Offset(1, 0).Range("I7").Select




MsgBox "One record written to Schedule"

response = MsgBox("Do you want to enter another record?", _
vbYesNo)

If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""

TextBox1.SetFocus

Else
Unload Me
End If

End Sub

Can someone please assist me in getting back on track with this one?
Thanks in advance for your help.

Kind Regards,
Chris McCourt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using a form to input data into a schedule

opening the workbook read only and checking the writereservedby property has
worked for me - but others have said it hasn't worked for them. I don't
know of another way than that.

--
Regards,
Tom Ogilvy

"Chris" wrote in message
om...
Hello to all:

I'm quite new to VBA and was working on a form to input data into a
schedule. I am updating certain fields within the schedule as others
have formulas based on the input. Not sure if I've approached it in
the correct manner but I cannot get the second data entry to go to the
next row below for each field. Please find the code that I used below:

Private Sub CommandButton1_Click()

Worksheets("Schedule").Activate
Dim Port As Object

Set Port = Worksheets("Schedule").Range("B7")
Port.Value = TextBox1.Text
ActiveCell.Offset(1, 0).Range("B7").Select

Dim ESOP As Object

Set ESOP = Worksheets("Schedule").Range("E7")
ESOP.Value = TextBox2.Text
ActiveCell.Offset(1, 0).Range("E7").Select

Dim Cargo As Object

Set C argo = Worksheets("Schedule").Range("H7")
Cargo.Value = TextBox3.Text
ActiveCell.Offset(1, 0).Range("H7").Select

Dim Prod As Object

Set Prod = Worksheets("Schedule").Range("I7")
Prod.Value = TextBox4.Text
ActiveCell.Offset(1, 0).Range("I7").Select




MsgBox "One record written to Schedule"

response = MsgBox("Do you want to enter another record?", _
vbYesNo)

If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""

TextBox1.SetFocus

Else
Unload Me
End If

End Sub

Can someone please assist me in getting back on track with this one?
Thanks in advance for your help.

Kind Regards,
Chris McCourt



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Reset data input form MichaelRobert Excel Worksheet Functions 5 September 18th 09 02:55 PM
input in number form is being multiplied by 1000 when i input. jweinograd Excel Discussion (Misc queries) 4 April 16th 07 11:18 PM
How can I have an input form to add a random no. to each input entry? saziz Excel Discussion (Misc queries) 2 January 25th 06 11:46 PM
format cell from data input to output form Brad Stevenson Excel Worksheet Functions 2 May 19th 05 06:04 PM
Data Input Execl Form Seb[_2_] Excel Programming 1 October 22nd 03 04:46 PM


All times are GMT +1. The time now is 05:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"