ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   linked cells loop? (https://www.excelbanter.com/excel-programming/293970-re-linked-cells-loop.html)

Tom Ogilvy

linked cells loop?
 
I guess I didn't read closely enough.

Define linked - essentially any cell that contains a formula that refers to
another cell could be linked - but I doubt that is what you mean.

--
Regards,
Tom Ogilvy



"Johnny Base" wrote in message
...
Is there a code.. such that

If a cell is a linked cell and in row 14 and greater, then Run code?

Example:
It would check if there is a linked cell in row 14... and find it, and

then run a code.
then it checks row 15 and finds linked items in row 15.. the code would

run
then it would check row 16... which has a linked cell, and the code would

run
and it should stop once there is no linked cell (or by another method)




Johnny Base

linked cells loop?
 
Hmmm Here is an example of linked cell in the definition that I am using:

In sheet1 I have "hehe" in A1
In sheet2, I have "='sheet1'!A1" in A3 and A3 shows "hehe"

I am unsure on how to explain it without an example....hope that clears things up....

Tom Ogilvy

linked cells loop?
 
Dim rng as Range
Dim rng1 as Range
Dim cell as Range

On Error Resume Next
set rng = Cells.Specialcells(xlformulas)
On Error goto 0
if not rng is nothing then
for each cell in rng
if instr(1,cell.formula,"!",vbTextcompare) then
' run code
' the below can be used to check if it is getting the right cells
if rng1 is nothing then
set rng1 = cell
else
set rng1 = union(rng1,cell)
end if
end if
Next
if not rng1 is nothing then
rng1.Select
End if
End if

--
Regards,
Tom Ogilvy


"Johnny Base" wrote in message
...
Hmmm Here is an example of linked cell in the definition that I am using:

In sheet1 I have "hehe" in A1
In sheet2, I have "='sheet1'!A1" in A3 and A3 shows "hehe"

I am unsure on how to explain it without an example....hope that clears

things up....



Johnny Base

linked cells loop?
 
Thank you Tom... It was great help


All times are GMT +1. The time now is 05:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com