Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating dropdown list 2 with data depending upon what was selected in list 1


I'm programming VB in Excel. I've created a series of simple lists in a
worksheet. I would like to select one object from list 1 in a cell in
column A and then have the cursor cell move to the right neighbouring
cell and present me with a dropdown menu showing the contents of
another list dependant on what was chosen in the first cell. Here's the
code so far:


Code:
--------------------
Sub Dropdownlist()

Dim cell As Variant

If (Range("A40:A4000").Select) Then
cell = ActiveCell.Address

Select Case (ActiveCell.FormulaR1C1)

Case "1. Tooling"
Range("B40").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$B$1:$B$11"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With

Case "2. Project Organisation"
Range("B40").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$C$1:$C$11"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With

End Select

End If

End Sub
--------------------


The problem is - how do I get the variable "cell" to move to the right
one cell? If I add "+1" I get the value $A$401 instead of $A$41 as I
would like

Many thanks for any help.


--
karambos
------------------------------------------------------------------------
karambos's Profile: http://www.excelforum.com/member.php...o&userid=16262
View this thread: http://www.excelforum.com/showthread...hreadid=276632

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default Populating dropdown list 2 with data depending upon what was selected in list 1

Hi karambos;


Use this idea

MyVariable = "$A$40"

Range(MyVariable).Offset(0, 1).Select


Thanks,

Greg




-----Original Message-----

I'm programming VB in Excel. I've created a series of

simple lists in a
worksheet. I would like to select one object from list 1

in a cell in
column A and then have the cursor cell move to the right

neighbouring
cell and present me with a dropdown menu showing the

contents of
another list dependant on what was chosen in the first

cell. Here's the
code so far:


Code:
--------------------
Sub Dropdownlist()

Dim cell As Variant

If (Range("A40:A4000").Select) Then
cell = ActiveCell.Address

Select Case (ActiveCell.FormulaR1C1)

Case "1. Tooling"
Range("B40").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList,

AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$B$1:$B$11"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With

Case "2. Project Organisation"
Range("B40").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList,

AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$C$1:$C$11"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With

End Select

End If

End Sub
--------------------


The problem is - how do I get the variable "cell" to move

to the right
one cell? If I add "+1" I get the value $A$401 instead of

$A$41 as I
would like

Many thanks for any help.


--
karambos
----------------------------------------------------------

--------------
karambos's Profile: http://www.excelforum.com/member.php?

action=getinfo&userid=16262
View this thread:

http://www.excelforum.com/showthread...hreadid=276632

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default Populating dropdown list 2 with data depending upon what was selected in list 1

karambos

See here for one method

http://www.dicks-blog.com/excel/2004...mbo_based.html

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"karambos" wrote in message
...

I'm programming VB in Excel. I've created a series of simple lists in a
worksheet. I would like to select one object from list 1 in a cell in
column A and then have the cursor cell move to the right neighbouring
cell and present me with a dropdown menu showing the contents of
another list dependant on what was chosen in the first cell. Here's the
code so far:


Code:
--------------------
Sub Dropdownlist()

Dim cell As Variant

If (Range("A40:A4000").Select) Then
cell = ActiveCell.Address

Select Case (ActiveCell.FormulaR1C1)

Case "1. Tooling"
Range("B40").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$B$1:$B$11"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With

Case "2. Project Organisation"
Range("B40").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$C$1:$C$11"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With

End Select

End If

End Sub
--------------------


The problem is - how do I get the variable "cell" to move to the right
one cell? If I add "+1" I get the value $A$401 instead of $A$41 as I
would like

Many thanks for any help.


--
karambos
------------------------------------------------------------------------
karambos's Profile:

http://www.excelforum.com/member.php...o&userid=16262
View this thread: http://www.excelforum.com/showthread...hreadid=276632



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
Populating a Data Validation List Jim Skrydlak Excel Discussion (Misc queries) 2 September 7th 07 12:00 AM
How do I show a value for selected text from a dropdown list? Matt Excel Discussion (Misc queries) 2 January 4th 07 06:49 AM
return a data list depending on a value selected within a drop dow loren Excel Discussion (Misc queries) 1 April 11th 05 05:17 PM
Populating a dropdown list with an Array MC[_3_] Excel Programming 3 March 4th 04 05:32 PM
Changing cell value depending on dropdown list RogerDaShrubber Excel Programming 2 February 3rd 04 12:17 AM


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

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"