Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default autowrite a cell depending on another cell's content

Hello all (newbie):

I need to: read the content of a cell input, compare its value with a list
of data and populate the contiguous cell with the corresponding value, like
an autocomplete function.

wich one is the easiest method?
i thought of
writing the data on another sheet, compare the value on a worksheet
event
same, but using an array
same, but with some sort of database-list
create one line txt files, import the text of the file named like the
cell input (managed to work this one, but seems clumsy)

all of them pose dificulties to me (new to this) so someone could please
tell me which one is easier-smarter and give me some guidelines, links or
code to get started.

the number of entries would be small-medium, not more than a hundred

I have an existing worksheet change event that does this with an image,
i.e., it reads a number from a cell and retrieves a jpg archive named with
that number. So another possible solution would be to read the caption
embedded within a jpg archive, but at first glance this seems complicated.

thanks in advance to all




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default autowrite a cell depending on another cell's content

The worksheet Vlookup function can do this without using code if your lookup
data is a worksheet.

This assumes the lookup value is in the leftmost column of the data. If
not, it can be done with a combination of Index and Match worksheet
functions. If you need to do it in code, you can use these functions in
code as well.

If the table of values is small, you can use the vlookup function with an
array

=Vlookup(A1,{1,"A";2,"B";3,"C";4,"D"},2,False)

where A1 contains a number between 1 and 4 inclusive - as an example.

--
Regards,
Tom Ogilvy



"jose carreno" wrote in message
...
Hello all (newbie):

I need to: read the content of a cell input, compare its value with a list
of data and populate the contiguous cell with the corresponding value,

like
an autocomplete function.

wich one is the easiest method?
i thought of
writing the data on another sheet, compare the value on a worksheet
event
same, but using an array
same, but with some sort of database-list
create one line txt files, import the text of the file named like the
cell input (managed to work this one, but seems clumsy)

all of them pose dificulties to me (new to this) so someone could please
tell me which one is easier-smarter and give me some guidelines, links or
code to get started.

the number of entries would be small-medium, not more than a hundred

I have an existing worksheet change event that does this with an image,
i.e., it reads a number from a cell and retrieves a jpg archive named with
that number. So another possible solution would be to read the caption
embedded within a jpg archive, but at first glance this seems complicated.

thanks in advance to all






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default solved, but

I got a neat solution, its a worksheet change event but it only works
whithin the same sheet. I inserted two Sheets("xx").Select commands that
just dont work. Any ideas?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim vModelo As Integer
Dim vFoto As String
Dim cell As Range
Dim vnext As String

Dim aRng As Range

If Target.Column < 4 Then Exit Sub
If Target.Row = 1 Then Exit Sub
vModelo = Target.Value
' Sheets("Hoja2").Select
Range("W1:W10").Name = "MyRange"
For Each cell In Range("MyRange")
If cell.Value = vModelo Then vnext = cell.Offset(0, 1).Value
Next cell
' Sheets("Hoja1").Select
Target.Offset(0, 1).Select
ActiveCell.Value = vnext
Set aRng = Nothing

End Sub


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
Find a cell's content in another cell but only as whole word(s) Paul Excel Worksheet Functions 2 February 5th 09 09:41 AM
Selecting a cell depending on the other cell's value, kind of wally_91[_4_] Links and Linking in Excel 2 April 2nd 08 05:12 PM
Printing cell's content larger than cell width Neophyte New Users to Excel 1 October 14th 07 09:20 PM
How do I get a cell to flash depending on another cell's value? trrrr Excel Worksheet Functions 3 May 8th 06 06:41 PM
Changing named range reference depending on a cell's content cparaske Excel Discussion (Misc queries) 1 July 29th 05 07:06 PM


All times are GMT +1. The time now is 09:38 AM.

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"