Can I show contents of a column based on cell focus in another?

joezeppy

Board Regular
Joined
Feb 7, 2005
Messages
72
Hi,

I have ten or so columns, each with a different Title in Columns C through L.

In Column A, I have a list of those Titles (downwards)

I would like to create a condition in Column B where if someone selects (or places focus) on one of the Titles in Column A, that the respective Column contents would show up in Column B.

Can this be done? How?

Any help appreciated!

Joe
 
Joe without using VBA, I think my solution is as close as you can get. The dropdown is easy to use. If you send me a personal message with your email, I can send you a sample workbook.

I've PM'd you in case I can't figure out the rest of that VBA code. Thanks much.
 
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Even before I get these answers, I want to thank you guys so much. This has to be one of the most cool forums I've ever been a part of. I almost ALWAYS find someone willing to help that really knows their stuff. Thank you guys (and girls I suppose)!
 
Upvote 0
I'm glad the code partially worked for you. I made one slight change just to account for errors happening. The only other reason I could think of why it wouldn't work is if the text in column A doesn't match perfectly with the column header. I changed the criteria of the "Find" method to be a "Part" instead of "Whole". e.g. The code will search for the string inside the range, and it doesn't have to match the text exactly.

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim ColNumber As Integer, LastRow As Long
    If Target.Count > 1 Then
        Exit Sub
    End If
    If Target.Column = 1 And Target.Value <> "" And Target.Row > 1 Then
        On Error GoTo EndMacro
        ColNumber = Range("C1:L1").Find(Trim(Target.Value), Range("C1"), xlValues, xlPart).Column
        Columns("B").ClearContents
        LastRow = Cells(1, ColNumber).End(xlDown).Row
        Range("B1:B" & LastRow) = Range(Cells(1, ColNumber), Cells(LastRow, ColNumber)).Value
    End If
EndMacro:
End Sub

Hopefully that solves the issue. Once you get a taste of how powerful VBA can be, your capabilities within Excel get exponentially greater! It was a project like this that got me extremely interested in VBA a couple years ago.

Good luck!
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top