Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if cell matches cell in column A in external workbook

Status
Not open for further replies.

renartbrazil

Technical User
Dec 12, 2003
42
US
I find myself looking at the same thing over and over when looking at specific data. Can not find any good examples on how to set it up. Simply looking to highlight a cell if it matches a cell in an external workbook. Any suggestions or links I possibably may have not come across to explain some of this? Sorry no example code to show off.
 
Not sure what you mean. If I set up two worksheets and call them Master and Slave, then put some value in "Master" in cell A1 and this formula in "Slave"
[tt]
=2*'C:\EXCEL\DATA\[Master.xls]Sheet1'!$A$1
[/tt]
then whenever I open "Slave" and "Master" is not already open, I get a prompt asking whether I want to update with data from another workbook. I click Yes and now have that value in the current book which I can now use for anything (such as Conditional Formatting).

If "Master" is open, the update is automatic. If "Master" is closed, I get the prompt, and it stays closed.

Is that what you mean?

 

Hi,

Code:
    Dim wsOther As Worksheet, wsThis as worksheet, rngThis as range
    Set wsThis = Activesheet
    Set wsOther = Workbooks.Open("c:\MyWorkbook.xls").Worksheets("MySheet")
    for each rngThis in wsthis.range(wsthis.[A1], wsthis.[A1].end(xldown))
       with rngthis
          if .value = wsother.cells(.row, .column).value then .interior.colorindex = 3
       end with
    next


Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 
Well, I can't get it to go for me. The one here is skip's that I need but can't get it to work. While I keep at it, just to clarify what it was. Two workbooks, one to keep something like an account number or something, then the other is where I will past information into that I may need to check out. Problem for me and likely many others out there is redundantcy. Looking at same stuff. So looking to flag this special number on the new stuff so I will not spend time looking at it again.

=2*'C:\EXCEL\DATA\[Master.xls]Sheet1'!$A$1

Zathras, not much experience with accessing external data here with excel , what does the =2' mean?
 

That was just an example. If the Master.xls sheet has 21 in cell A1 then the cell with the formula in Slave.xla would have the value 42. If it was referencing a cell in the same sheet, the formula would have been simply
[tt]
=2*$A$1
[/tt]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top