Solved

valuelist value to assign variables to colums in different sheets

Posted on 2013-11-21
3
215 Views
Last Modified: 2013-11-22
folks

sheet 1

column 2        column b
uk                  london
usa                 wash dc
france               paris

i need a valuelist when selecting a value from colum a then it will write  the selected value
from colum a to sheet 2 column a 5 times and write the corresponding colum b value 10 times to sheet 3

any ideas? i have attached the output requirement on excel for further explanation
sheet-valuelist.xlsx
0
Comment
Question by:rutgermons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39668142
How do you intend to "Select" a value from column A? Do you just put the cursor on the value?
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39668154
If you want to place the cursor on the value then
You can use this code in the worksheet module

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column = 1 Then
        Sheet2.Range("A2").Resize(5).Value = Target.Value
        Sheet3.Range("A2").Resize(10).Value = Target.Offset(, 1).Value
    End If
End Sub

Open in new window


To use the code
Right-click on the sheet tab name
Select View code
Paste this code in the VBA window
Close the VBA window
0
 
LVL 22

Accepted Solution

by:
Flyster earned 500 total points
ID: 39668175
See Combobox on sheet1. This code is used to populate it:
Private Sub ComboBox1_GotFocus()
Dim r As Long

r = Sheet1.Range("A1").Offset(Sheet1.Rows.Count - 1, 0).End(xlUp).Row
    With ComboBox1
        .ColumnCount = 2
        .List = Range("A2:B" & r).Value
    End With

End Sub

Open in new window

If more locations are added, they will appear in the combobox.
Flyster
sheet-valuelist-Combobox.xlsm
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question