Solved

valuelist value to assign variables to colums in different sheets

Posted on 2013-11-21
3
228 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

623 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