View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Super piece of code..At least for me!!

the code just uses data validation as you could do manually by selecting a
cell and doing Data=Validation in the menu and then selecting the LIST
option. In you case you would put in

=ListRange

Data validation only works on the cell where it is applied - so you could
not select from the dropdown in A1 and have the selected value appear in B9
unless B9 had the formula =A1 in which case, it would appear in both
cells.

--

Regards,
Tom Ogilvy


"Arishy" wrote in message
oups.com...
I came accross this code and of course I have a question hope to
resolve it with your help.

Here it is

Public Sub CreateList()
With ActiveCell
.Validation.Delete
.Validation.Add xlValidateList, , , "=" & "ListRange"
End With
End Sub

Put it in standard module

1. Sheet1 create a botton to activate this macro
2. sheet2 create a range of one column Say A1:A12 with data say
Jan,Feb etc Name it ListRange.
3. Now goback to Sheet1 and at ANY ACTIVE CELL click Botton1
You will notice the creation of a List (with black Triangle)
Click on it you will get a list of Jan,.... Select one and you have it
in the active cell.

I realy do not know how it works, my question is can I place the
selected text from the list somewhere else in sheet1 ? say left cell???

I hope you see the beuty of this code as I did.