Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How do I do this?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default How do I do this?

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How do I do this?

This kinda does what I want, except that I want this selection on each
sheet in the workbook, in column F2:F4000.



Scott wrote:
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default How do I do this?

This will loop through all worksheets in your workbook.

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

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

For Each WS In Worksheets
With WS.Range("F2:F4000").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
Next
End Sub

Scott

Blasting Cap wrote:
This kinda does what I want, except that I want this selection on each
sheet in the workbook, in column F2:F4000.



Scott wrote:
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



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



All times are GMT +1. The time now is 05:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"