Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Help with a form

Greetings,

I need some help. I have a userform that I have created that basically
updates the information a person inputs into an excel spreadsheet. We have a
tracking database for emails we send and receive. Prior to the form we would
just cut and paste everything into an excel spreadsheet. This form really
brings efficency to the process. I have one error that I cannot find
resolution to. I have two text boxes one needs to be the email that a
customer sent us, and one is the email we send back to the client. Some of
these are so long that I get a runtime error 1004.

Before these would update fine to the spreadsheet, you just had to double
click on the cell and paste it. I have put my code below. Is there any
adjustment I can make so that the code will update the spreadsheet.


Basically the email is cut and pasted into a text box, then an update button
is clicked which executes the following code, and takes each of the text
boxes and updates it to their respective cell.


Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'update respective cells from the form
ws.Cells(iRow, 3).Value = Date
ws.Cells(iRow, 2).Value = TextBox7
ws.Cells(iRow, 1).Value = TextBox8
ws.Cells(iRow, 4).Value = TextBox1
ws.Cells(iRow, 5).Value = TextBox2
ws.Cells(iRow, 6).Value = TextBox3
ws.Cells(iRow, 8).Value = TextBox9
ws.Cells(iRow, 9).Value = TextBox5
ws.Cells(iRow, 10).Value = TextBox6
ws.Cells(iRow, 7).Value = ComboBox1

'clear the form for next entry
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox9.Value = ""
TextBox5.Value = ""
TextBox6.Value = ""
TextBox7.Value = ""
TextBox8.Value = ""
ComboBox1.Value = ""
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Help with a form

Your problem description is a little ambiguous, but I can offer one
suggestion. Add .Value after your control names:

ws.Cells(iRow, 3).Value = Date
ws.Cells(iRow, 2).Value = TextBox7.Value
ws.Cells(iRow, 1).Value = TextBox8.Value
ws.Cells(iRow, 4).Value = TextBox1.Value
ws.Cells(iRow, 5).Value = TextBox2.Value
ws.Cells(iRow, 6).Value = TextBox3.Value
ws.Cells(iRow, 8).Value = TextBox9.Value
ws.Cells(iRow, 9).Value = TextBox5.Value
ws.Cells(iRow, 10).Value = TextBox6.Value
ws.Cells(iRow, 7).Value = ComboBox1.Value

You mention that you have two text boxes that handle email that cause a
problem and then your code lists eight textboxes and a combo box. You
mention that you get a 1004 runtime error but don't say what the message is.
If you could be a little more specific about which textboxes, by number,
cause the problem, and what the error message says, maybe one of us can offer
a better solution.


"Brent Sweet" wrote:

Greetings,

I need some help. I have a userform that I have created that basically
updates the information a person inputs into an excel spreadsheet. We have a
tracking database for emails we send and receive. Prior to the form we would
just cut and paste everything into an excel spreadsheet. This form really
brings efficency to the process. I have one error that I cannot find
resolution to. I have two text boxes one needs to be the email that a
customer sent us, and one is the email we send back to the client. Some of
these are so long that I get a runtime error 1004.

Before these would update fine to the spreadsheet, you just had to double
click on the cell and paste it. I have put my code below. Is there any
adjustment I can make so that the code will update the spreadsheet.


Basically the email is cut and pasted into a text box, then an update button
is clicked which executes the following code, and takes each of the text
boxes and updates it to their respective cell.


Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'update respective cells from the form
ws.Cells(iRow, 3).Value = Date
ws.Cells(iRow, 2).Value = TextBox7
ws.Cells(iRow, 1).Value = TextBox8
ws.Cells(iRow, 4).Value = TextBox1
ws.Cells(iRow, 5).Value = TextBox2
ws.Cells(iRow, 6).Value = TextBox3
ws.Cells(iRow, 8).Value = TextBox9
ws.Cells(iRow, 9).Value = TextBox5
ws.Cells(iRow, 10).Value = TextBox6
ws.Cells(iRow, 7).Value = ComboBox1

'clear the form for next entry
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox9.Value = ""
TextBox5.Value = ""
TextBox6.Value = ""
TextBox7.Value = ""
TextBox8.Value = ""
ComboBox1.Value = ""
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Help with a form

Actually, that did the trick. Adding the .value did. What exactly does that
do?

"JLGWhiz" wrote:

Your problem description is a little ambiguous, but I can offer one
suggestion. Add .Value after your control names:

ws.Cells(iRow, 3).Value = Date
ws.Cells(iRow, 2).Value = TextBox7.Value
ws.Cells(iRow, 1).Value = TextBox8.Value
ws.Cells(iRow, 4).Value = TextBox1.Value
ws.Cells(iRow, 5).Value = TextBox2.Value
ws.Cells(iRow, 6).Value = TextBox3.Value
ws.Cells(iRow, 8).Value = TextBox9.Value
ws.Cells(iRow, 9).Value = TextBox5.Value
ws.Cells(iRow, 10).Value = TextBox6.Value
ws.Cells(iRow, 7).Value = ComboBox1.Value

You mention that you have two text boxes that handle email that cause a
problem and then your code lists eight textboxes and a combo box. You
mention that you get a 1004 runtime error but don't say what the message is.
If you could be a little more specific about which textboxes, by number,
cause the problem, and what the error message says, maybe one of us can offer
a better solution.


"Brent Sweet" wrote:

Greetings,

I need some help. I have a userform that I have created that basically
updates the information a person inputs into an excel spreadsheet. We have a
tracking database for emails we send and receive. Prior to the form we would
just cut and paste everything into an excel spreadsheet. This form really
brings efficency to the process. I have one error that I cannot find
resolution to. I have two text boxes one needs to be the email that a
customer sent us, and one is the email we send back to the client. Some of
these are so long that I get a runtime error 1004.

Before these would update fine to the spreadsheet, you just had to double
click on the cell and paste it. I have put my code below. Is there any
adjustment I can make so that the code will update the spreadsheet.


Basically the email is cut and pasted into a text box, then an update button
is clicked which executes the following code, and takes each of the text
boxes and updates it to their respective cell.


Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'update respective cells from the form
ws.Cells(iRow, 3).Value = Date
ws.Cells(iRow, 2).Value = TextBox7
ws.Cells(iRow, 1).Value = TextBox8
ws.Cells(iRow, 4).Value = TextBox1
ws.Cells(iRow, 5).Value = TextBox2
ws.Cells(iRow, 6).Value = TextBox3
ws.Cells(iRow, 8).Value = TextBox9
ws.Cells(iRow, 9).Value = TextBox5
ws.Cells(iRow, 10).Value = TextBox6
ws.Cells(iRow, 7).Value = ComboBox1

'clear the form for next entry
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox9.Value = ""
TextBox5.Value = ""
TextBox6.Value = ""
TextBox7.Value = ""
TextBox8.Value = ""
ComboBox1.Value = ""
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Help with a form

One analogy would be the difference between going to the market and going to
the market for groceries. Textbox is the market, Value is the groceries.

"Brent Sweet" wrote:

Actually, that did the trick. Adding the .value did. What exactly does that
do?

"JLGWhiz" wrote:

Your problem description is a little ambiguous, but I can offer one
suggestion. Add .Value after your control names:

ws.Cells(iRow, 3).Value = Date
ws.Cells(iRow, 2).Value = TextBox7.Value
ws.Cells(iRow, 1).Value = TextBox8.Value
ws.Cells(iRow, 4).Value = TextBox1.Value
ws.Cells(iRow, 5).Value = TextBox2.Value
ws.Cells(iRow, 6).Value = TextBox3.Value
ws.Cells(iRow, 8).Value = TextBox9.Value
ws.Cells(iRow, 9).Value = TextBox5.Value
ws.Cells(iRow, 10).Value = TextBox6.Value
ws.Cells(iRow, 7).Value = ComboBox1.Value

You mention that you have two text boxes that handle email that cause a
problem and then your code lists eight textboxes and a combo box. You
mention that you get a 1004 runtime error but don't say what the message is.
If you could be a little more specific about which textboxes, by number,
cause the problem, and what the error message says, maybe one of us can offer
a better solution.


"Brent Sweet" wrote:

Greetings,

I need some help. I have a userform that I have created that basically
updates the information a person inputs into an excel spreadsheet. We have a
tracking database for emails we send and receive. Prior to the form we would
just cut and paste everything into an excel spreadsheet. This form really
brings efficency to the process. I have one error that I cannot find
resolution to. I have two text boxes one needs to be the email that a
customer sent us, and one is the email we send back to the client. Some of
these are so long that I get a runtime error 1004.

Before these would update fine to the spreadsheet, you just had to double
click on the cell and paste it. I have put my code below. Is there any
adjustment I can make so that the code will update the spreadsheet.


Basically the email is cut and pasted into a text box, then an update button
is clicked which executes the following code, and takes each of the text
boxes and updates it to their respective cell.


Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'update respective cells from the form
ws.Cells(iRow, 3).Value = Date
ws.Cells(iRow, 2).Value = TextBox7
ws.Cells(iRow, 1).Value = TextBox8
ws.Cells(iRow, 4).Value = TextBox1
ws.Cells(iRow, 5).Value = TextBox2
ws.Cells(iRow, 6).Value = TextBox3
ws.Cells(iRow, 8).Value = TextBox9
ws.Cells(iRow, 9).Value = TextBox5
ws.Cells(iRow, 10).Value = TextBox6
ws.Cells(iRow, 7).Value = ComboBox1

'clear the form for next entry
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox9.Value = ""
TextBox5.Value = ""
TextBox6.Value = ""
TextBox7.Value = ""
TextBox8.Value = ""
ComboBox1.Value = ""
End Sub

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
Call user form from ThisWorkbook; close file if form closed XP Excel Programming 2 July 20th 07 07:04 PM
Pass variable from form to form to form headly Excel Programming 1 May 31st 06 02:50 AM
Strange issue freezing parent form when unloading a child form Stefano Gatto Excel Programming 1 November 11th 05 04:42 PM
Help! Animated gif-image in form does not show animation when form loaded JoCa Excel Programming 4 September 23rd 04 07:43 PM
Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form? Daniel[_14_] Excel Programming 1 August 29th 04 01:20 PM


All times are GMT +1. The time now is 04:20 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"