Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Reject Manual Input

I have two questions for a list box. I have the code to put the list box in
thanks to this list. Now I need to do 2 things

1. Make sure typed in data is rejected unless the list box was used
2. Make sure the cursor is always in Column "C" before entering the
contents of the list box.

I seem to remember a way to auto run a macro on workbook open, but can't
find
it in the help files. I know it was something simply like naming the macro
Automatic or something

CODE FOR "OK" Button

Private Sub cmdOK_Click()
Dim strnames As String
Dim x As Integer

For x = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(x) Then
strnames = strnames & ListBox1.List(x) & ", "
End If
Next x

If Not strnames = "" Then
strnames = Left(strnames, Len(strnames) - 1)
End If
ActiveCell.Value = strnames

ListBox1.RowSource = "MyList"

End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Reject Manual Input

You can use the Workbook_Open event in the ThisWorkbook module or in a
general module name your macro Auto_Open

See Chip Pearson's page on events for an overview
http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy


"SMERTZ" wrote in message
...
I have two questions for a list box. I have the code to put the list box

in
thanks to this list. Now I need to do 2 things

1. Make sure typed in data is rejected unless the list box was used
2. Make sure the cursor is always in Column "C" before entering the
contents of the list box.

I seem to remember a way to auto run a macro on workbook open, but can't
find
it in the help files. I know it was something simply like naming the

macro
Automatic or something

CODE FOR "OK" Button

Private Sub cmdOK_Click()
Dim strnames As String
Dim x As Integer

For x = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(x) Then
strnames = strnames & ListBox1.List(x) & ", "
End If
Next x

If Not strnames = "" Then
strnames = Left(strnames, Len(strnames) - 1)
End If
ActiveCell.Value = strnames

ListBox1.RowSource = "MyList"

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
Manual Input/Calculation in Same Cell Jean9 Excel Discussion (Misc queries) 3 November 8th 07 04:00 PM
Cell Reference VS. Manual Input? K-Roq Excel Worksheet Functions 2 September 26th 07 07:57 PM
Lock out manual input to cells? Jon[_21_] Excel Programming 2 November 11th 05 09:01 PM
Use checkbox to toggle between formula and manual input packat Excel Programming 9 December 22nd 04 12:16 PM
Manual Input During Macro Execution Sherlock[_2_] Excel Programming 5 April 27th 04 04:59 PM


All times are GMT +1. The time now is 02:56 AM.

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"