Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50142

How to trigger an "Exit For" command from a For Loop, when a cell in another workbook....

$
0
0
Hi,

I am brand-spanking new to VBA, and I have really been learning it from scratch over the past few days mostly using Google.

I am trying to figure out how to write If/Then code to inspect the contents of a cell in another open workbook, and if the words "Stop Recording" are present, then initiate an "Exit For" command, otherwise keep on trucking within the current loop (counting down from thousands). I am hoping to find a simple way to write the code, with a specific example shown. My loop is writing DDE linked data into a workbook, so I don't want to interrupt that process by accidentally leaving another workbook active during this if/then test.

For example, I am writing DDE code to Sheet1 in workbook "Data" and I want to initiate an "Exit For" if cell (A,24) in the currently open workbook "Console" receives the words "Stop Recording".

Thanks in advance

Viewing all articles
Browse latest Browse all 50142

Trending Articles