Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Data from user form to certain cell


I am trying to take a few items selected from a user form and inser
them into certain cells in a given worksheet. Below is the code,
think I am close however it does not work. Any suggestions?

Private Sub CommandButton1_Click()

Sheet1.Cells("F1").Value = ComboBox2.Text <<This is my issue
Sheet1.Cells("F2").Value = ComboBox2.Text <<This is my issue

MsgBox "One record written to Sheet1"

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

If response = vbNo Then
Unload Me
End If

End Su

--
parteegolfe
-----------------------------------------------------------------------
parteegolfer's Profile: http://www.excelforum.com/member.php...fo&userid=3195
View this thread: http://www.excelforum.com/showthread.php?threadid=52529

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Data from user form to certain cell

Did you mean?

Worksheets("Sheet1").Cells("F1").Value = ComboBox2.Text

*** Sent via Developersdex http://www.developersdex.com ***
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Data from user form to certain cell

I don't usually uses Cells. I use Offset. And I've discovered that Cells
will not take string. You would have to use an index or row column
number.


Worksheets("Sheets1").Cells(1,6) = ComboBox2.Text ' F1
Worksheets("Sheets1").Cells(2,6) = ComboBox2.Text ' F2

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Data from user form to certain cell


when I entered this code I got a "sub or function not defined erro

--
parteegolfe
-----------------------------------------------------------------------
parteegolfer's Profile: http://www.excelforum.com/member.php...fo&userid=3195
View this thread: http://www.excelforum.com/showthread.php?threadid=52529

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Data from user form to certain cell

Maybe I should pay closer attention to my typing. Sorry.

Try this.

Option Explicit

Private Sub UserForm_Initialize()
ComboBox2.AddItem "One"
ComboBox2.AddItem "Two"
ComboBox2.AddItem "Three"
End Sub

Private Sub CommandButton1_Click()

Dim response As String

Worksheets("Sheet1").Cells(1, 6).Value = ComboBox2.Text
Worksheets("Sheet1").Cells(2, 6).Value = ComboBox2.Text

MsgBox "One record written to Sheet1"

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

If response = vbNo Then
Unload Me
End If

End Sub




*** Sent via Developersdex http://www.developersdex.com ***
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
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
Reading Data from a User Form. Aaron1978 Excel Programming 2 February 5th 06 07:19 PM
Data Entry Alert in User Form Kev Excel Discussion (Misc queries) 6 January 8th 05 03:01 PM
Trouble with editing data from a user form ryssa[_10_] Excel Programming 1 July 1st 04 06:12 PM
How To: create a form for a user to enter data Ciscolo Bandero Excel Programming 3 April 16th 04 08:54 PM


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