Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Returning a value dependant on a cell...

Hi Everyone,

I have two tables, the first lists letters from AA to ZZ in a lookup type
list and when on of these is selected, for example AB, the corresponding cell
in the second table (the equivalent AB) is populated with a Y.

Table A: Table B:

Type Site Controls Type Has Site Control
AA (various data) AA Y
AB " AB Y
DZ " DZ Y
LW " LW Y

So, as the data is selected in table A, the Y should be populated in table
B. I would appreciate the help on this as it would speed up my tasks
considerably.

Thanks in advance,

Remy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Returning a value dependant on a cell...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iPos As Long
If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
With Target
iPos = Application.Match(Target.Value, Range("M:M"), 0)
If iPos 0 Then
Cells(iPos, "N").Value = "Y"
End If
End With
End If
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

This assumes the first table is A1:Bn, and the second is M1:Mn. Change to
suit.

--
HTH

Bob Phillips

"RemySS" wrote in message
...
Hi Everyone,

I have two tables, the first lists letters from AA to ZZ in a lookup type
list and when on of these is selected, for example AB, the corresponding

cell
in the second table (the equivalent AB) is populated with a Y.

Table A: Table B:

Type Site Controls Type Has Site Control
AA (various data) AA Y
AB " AB Y
DZ " DZ Y
LW " LW Y

So, as the data is selected in table A, the Y should be populated in table
B. I would appreciate the help on this as it would speed up my tasks
considerably.

Thanks in advance,

Remy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Returning a value dependant on a cell...

Bob,

Thanks for the code, I've tried to implement as you said. However, even
after changing the table ranges I got no response from the code, it did
nothing except to give me an error (13) stating a type mismatch...any further
help you could provide?

"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iPos As Long
If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
With Target
iPos = Application.Match(Target.Value, Range("M:M"), 0)
If iPos 0 Then
Cells(iPos, "N").Value = "Y"
End If
End With
End If
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

This assumes the first table is A1:Bn, and the second is M1:Mn. Change to
suit.

--
HTH

Bob Phillips

"RemySS" wrote in message
...
Hi Everyone,

I have two tables, the first lists letters from AA to ZZ in a lookup type
list and when on of these is selected, for example AB, the corresponding

cell
in the second table (the equivalent AB) is populated with a Y.

Table A: Table B:

Type Site Controls Type Has Site Control
AA (various data) AA Y
AB " AB Y
DZ " DZ Y
LW " LW Y

So, as the data is selected in table A, the Y should be populated in table
B. I would appreciate the help on this as it would speed up my tasks
considerably.

Thanks in advance,

Remy




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Returning a value dependant on a cell...

Try this slightly amended version

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iPos As Long
If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
With Target
On Error Resume Next
iPos = Application.Match(Target.Value, Range("M:M"), 0)
On Error GoTo 0
If iPos 0 Then
Cells(iPos, "N").Value = "Y"
End If
End With
End If
End Sub


--
HTH

Bob Phillips

"RemySS" wrote in message
...
Bob,

Thanks for the code, I've tried to implement as you said. However, even
after changing the table ranges I got no response from the code, it did
nothing except to give me an error (13) stating a type mismatch...any

further
help you could provide?

"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iPos As Long
If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
With Target
iPos = Application.Match(Target.Value, Range("M:M"), 0)
If iPos 0 Then
Cells(iPos, "N").Value = "Y"
End If
End With
End If
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

This assumes the first table is A1:Bn, and the second is M1:Mn. Change

to
suit.

--
HTH

Bob Phillips

"RemySS" wrote in message
...
Hi Everyone,

I have two tables, the first lists letters from AA to ZZ in a lookup

type
list and when on of these is selected, for example AB, the

corresponding
cell
in the second table (the equivalent AB) is populated with a Y.

Table A: Table B:

Type Site Controls Type Has Site Control
AA (various data) AA Y
AB " AB Y
DZ " DZ Y
LW " LW Y

So, as the data is selected in table A, the Y should be populated in

table
B. I would appreciate the help on this as it would speed up my tasks
considerably.

Thanks in advance,

Remy






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
Row Numbering dependant on amount in a cell Monkey Excel Discussion (Misc queries) 1 November 17th 08 02:53 PM
Show or blank out a cell dependant on an selection in another cell Larsb001 Excel Discussion (Misc queries) 0 July 10th 08 02:55 PM
Dependant cell tracking Iriemon Excel Worksheet Functions 1 April 24th 08 04:33 PM
Returning a Value from a Table, dependant on the word Typed Robert Excel Worksheet Functions 12 November 1st 07 08:20 PM
Returning a Value dependant on a cell which could have different d RemySS Excel Worksheet Functions 2 August 25th 05 03:04 PM


All times are GMT +1. The time now is 11:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"