Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Syd Syd is offline
external usenet poster
 
Posts: 6
Default Help - Using VBA with a validation dropdown list and a table to expand the entries

I am trying to use VBA to expand an entry from a dropdown validation list
into its individual components when certain items are selected.

I enter Tool Descriptions in Column 3 in my spreadsheet by selection from a
DropDown Validation list.
I also have various combinations of the tools which I select from the list
as Kit1, Kit2 ..........etc.


When a Kit is selected from a drop down validation list the VBA program I
created below I hoped would populate the cells in the column from a table
with all the individual tool descriptions which make up the Kit. However it
only partially works as required.


When I select a kit from the validation list the description (Eg. Kit1)
appears in the cell and not the various descriptions that make up the Kit1.
If I then click on the empty cell below and then again on the cell above
(Kit1) it populates the cells with the tools correctly.


How do I get the cells populated immediately I select a kit without having
to click twice as described above?


I use a case statement for the different kits which calls the relevant sub
programs as follows:


Sub Worksheet_SelectionChange(By Val Target as Range)
Dim CodeRow As Interger
Dim CodeCol As Interger
Dim Count As Interger


Select Case Target.Value
Case "Kit 1"
Call Kit1
Case"Kit 2"
Call Kit2
Case Else
End Select
End Sub


I then have Private Sub Programs for each Case. (Kit)
The Tool Descriptions are located in a Table in Column 10


Example for Kit1.


Private Sub Kit1()
Dim ToolDescription
Dim ContentsRow As Integer
Dim ContentsCol as Integer


ContentsCol = 10
CodeCol = 3
CodeRow = ActiveCell.Row (Where the Tool Description is to be
entered)


Contents Row = 19 (First Tool Description for
Kit1 is located in the table in Col10 Row 19)
ToolDescription = Cells(ContentsRow,ContentsCol).Value
Cells(CodeRow,CodeCol).Value = ToolDescription
CodeRow = CodeRow + 1 (Increments to next Row)


Contents Row = 20
ToolDescription = Cells(ContentsRow,ContentsCol).Value
Cells(CodeRow,CodeCol).Value = ItemDescription
CodeRow = CodeRow + 1


Contents Row = 21
ItemDescription = Cells(ContentsRow,ContentsCol).Value
Cells(CodeRow,CodeCol).Value = ToolDescription
CodeRow = CodeRow + 1


End Sub


Thanks for the anticipated help.
Syd



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
Validation dropdown list is not available Makelei Excel Discussion (Misc queries) 1 March 25th 10 08:06 PM
Validation Dropdown list starts at b ottom of list Tonso Excel Discussion (Misc queries) 2 March 17th 10 05:21 PM
pivot table source data expand to new entries when refresh? DianneZ Excel Discussion (Misc queries) 4 October 14th 08 03:58 PM
Change the length of the dropdown list used to cell entries Anastasia Excel Discussion (Misc queries) 3 January 24th 07 04:21 AM
How increase # visible entries in dropdown list box so no scroll? sciteecher New Users to Excel 4 February 20th 06 10:06 AM


All times are GMT +1. The time now is 12:45 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"