Mapping Data

keranali

Rules Violation
Joined
Oct 4, 2010
Messages
234
Office Version
  1. 365
Platform
  1. Windows
Hi all how do you click on rows to populate columns lets say A2 has a row to text straight to G2 and A3 to G3 and so on, I want to populate column I with the row info, now when I click either A2 row or A3 row the same column changes to reflect the clicked row information.

Please help
thanks
 
Thank you very much for teaching me its like a puzzle I got It

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim LastRw As Long, ThisRw As Long

LastRw = Range("A" & Rows.Count).End(xlUp).Row
If Intersect(ActiveCell, Range("A2:I" & LastRw)) Is Nothing Then
Range("w3:w5,w8:w11").ClearContents
Else
ThisRw = ActiveCell.Row
Range("w3:w5").Value = Application.Transpose(Cells(ThisRw, "G").Resize(, 3).Value)
Range("w8:w12").Value = Application.Transpose(Cells(ThisRw, "B").Resize(, 5).Value)
End If
End Sub

Yay You guys are really smart
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Me again can those dropdown lists from the control form work with this formulation VBA?

K
 
Upvote 0
Thank you very much for teaching me its like a puzzle I got It

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim LastRw As Long, ThisRw As Long

LastRw = Range("A" & Rows.Count).End(xlUp).Row
If Intersect(ActiveCell, Range("A2:I" & LastRw)) Is Nothing Then
Range("w3:w5,w8:w11").ClearContents
Else
ThisRw = ActiveCell.Row
Range("w3:w5").Value = Application.Transpose(Cells(ThisRw, "G").Resize(, 3).Value)
Range("w8:w12").Value = Application.Transpose(Cells(ThisRw, "B").Resize(, 5).Value)
End If
End Sub

Yay You guys are really smart
Perhaps you don't have anything in column F (I don't know because it was hidden in your post) but you are actually copying it to column W as well. Did you mean to do that? If not, look at the highlighted change in the code below.

You seem to be ignoring my comments/requests about using Code Tags to post code. If you post unformatted code you will find that many of the best vba helpers in the forum will just ignore your question. Click the 'Quote' button at the bottom of this post of mine and you will see how easy it is to put the code tags at the start and end of the vba code. Presumably you can see how much easier mine is to see where each block of code (eg If ... Else ... End If) starts and ends.

Rich (BB code):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim LastRw As Long, ThisRw As Long
    
    LastRw = Range("A" & Rows.Count).End(xlUp).Row
    If Intersect(ActiveCell, Range("A2:I" & LastRw)) Is Nothing Then
        Range("w3:w5,w8:w11").ClearContents
    Else
        ThisRw = ActiveCell.Row
        Range("w3:w5").Value = Application.Transpose(Cells(ThisRw, "G").Resize(, 3).Value)
        Range("w8:w11").Value = Application.Transpose(Cells(ThisRw, "B").Resize(, 4).Value)
    End If
End Sub

Me again can those dropdown lists from the control form work with this formulation VBA?

K
Almost certainly the answer is "Yes" but to get more detail you would have to explain just what you have and what you want to achieve.

If it is not directly related to what has already occurred in this thread then you would be best to start a new thread about that.
 
Upvote 0
I am very sorry about the code placement I will do In the future Your VBA code worked splendid exactly what I wanted thank you, I n column B and C I want to be able to have a drop down list because the fields will be in use over and over the database should be in sheet 2 I know how to make a combo box but I dont know how to link it to the changing data?
Excel Workbook
ABCDEHIJKLMNOPQRSTUVW
1TRACKING NUMBERBRANCH NAMEADDRESSTEL.FAXEMAIL.WWWNAMEPOSITION
2AAAABBBBCCCCDDDDEEEEFFFFGGGG
3
4
5
6
7
8
9
10
11
12
Sheet1






Thanks
Keran
 
Upvote 0
I n column B and C I want to be able to have a drop down list because the fields will be in use over and over the database should be in sheet 2 I know how to make a combo box
Could you just use Excel's built-in Data Validation in columns B & C rather than worrying about Combo Boxes?

Are you the owner of Mr.excel website?
No, the owner is Bill Jelen aka MrExcel
 
Upvote 0
Hi Peter I will try that data validation feature, can you teach me some stuff in VBA do you offer classes??

K
 
Upvote 0
Last edited:
Upvote 0
Thanks for all your help thus far the data validation method worked well however if Column C row 2 has the data validation table how possible is it to populate in col D row 2 information from sheet 2. I dont know if i am making sense,


Excel Workbook
ABCDEFGHIJ
1BRANCH NAMEADDRESSADDRESS 2ADDRESS 3ADDRESS 4ADDRESS 5ADDDRESS 6ADDRESS 7ADDRESS 8ADDRESS 9
2ArimaCorner Pro Queen & Devenish Streets, ArimaJAMES LAND TOBAGOCROSS CROSSING******
3Carlton CentreSt. James Street, Carlton Centre, San Fernando********
4ChaguanasChaguanas main road Spain********
5Royal Plaza, Main Road, Chaguanas********
6ChaguaramasWestern Main Road, Chaguaramas********
7CouvaCouva Shopping Complex, Southern Main Road, Couva********
Sheet3


So if some one clicks on an item in the validation list the next list limits the amount of searches to address 1 2 3 4 5 6 7 8 9 10.

Thanks
 
Upvote 0
Can't give an exact formula since I don't know what is on Sheet2 or how it is laid out but I suspect there is a table of data there in which case most likely a VLOOKUP or HLOOKUP function would be what you want. Have a look at those in the built-in Help.
 
Upvote 0

Forum statistics

Threads
1,215,695
Messages
6,126,263
Members
449,307
Latest member
Andile

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