Re: How do I do this?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If you're trying to do the validation in VBA, here's some sample code
that does something similar to what you're looking for. (I included
some of the defaults too -- obtained from recording when I set the
validation)

Sub Test()
Dim WS As Worksheet
Dim Choices As String

Set WS = Worksheets("Sheet1")

Choices = "This" & "," & "Is" & "," & "A" & "," & "Test"

With WS.Range("A1:A20").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:=Choices
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub

To do the Customer Name one, someone else may have a better method
(I've not done much with database inquiries), but you can record
obtaining the list, then manipulate the macro to put the list of names
where you want (ie. in the validation list).

Scott

Blasting Cap wrote:
I have a workbook with about 10 sheets in it, one for each of several
CSR's. On the first sheet, I plan to consolidate the data from the
other sheets, and on the second, third, fourth, fifth.... sheets, is a
sheet for each CSR to enter data.

On one column, I would like to have a dropdown box for each cell in that
column, that would have a CSR code in it. It's a small list, one that
would not require an external data source, but I'd want it to be just a
dropdown box on that cell.

How do I do that?


Also, on another cell - Customer Name - I'd like to populate that with
data from a SQL table based on a customer number. Is it possible to do
that in a dropdown box as well?

Any help appreciated.

BC

.



Relevant Pages

  • Re: List values based on different values selected
    ... etc.then the settings for data validation in B2 should read; ... a named range and is that used as data validation in a cell ... Consider states such as (Alaska, Arizona....) are listed in dropdown ...
    (microsoft.public.excel.misc)
  • Re: List values based on different values selected
    ... Once you have created the validation rule for cell B2 you can select B2 ... Consider states such as (Alaska, Arizona....) are listed in dropdown ...
    (microsoft.public.excel.misc)
  • RE: Prevent duplicate entries within a range of cells from a drop-
    ... Tried that however only manual entries are validated. ... --Select Data Validation ... --Select Custom from the 'Allow' dropdown and enter the below formula ... Cell Range is B2:F2 ...
    (microsoft.public.excel.programming)
  • Re: Validation blues
    ... There is probably a blank cell at the bottom of your list source. ... > The problem is that when I select a cell having validation then the dropdown ...
    (microsoft.public.excel.misc)
  • Re: Check Validation List for Matching Entries at Start-up
    ... dynamic named range in another workbook (This has caused problems ... For Each cell In Validatecells ... validation, since that is a know range called rInputRefName. ... I even moved it to a workbook with data in the area with the ...
    (microsoft.public.excel.programming)