ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   For Each cell - Variable not defined (VBA) (https://www.excelbanter.com/excel-programming/381876-each-cell-variable-not-defined-vba.html)

Shlomit

For Each cell - Variable not defined (VBA)
 
Hi,

I wrote code that inclue :
For Each cell In myRng
....
next
I got error "Variable not defined" and I don't find the reason.
(I some cases it's work but I didn't seccess to recognize when).

Please help, thanks
Shlomit

Leo Heuser

For Each cell - Variable not defined (VBA)
 
"Shlomit" skrev i en meddelelse
...
Hi,

I wrote code that inclue :
For Each cell In myRng
...
next
I got error "Variable not defined" and I don't find the reason.
(I some cases it's work but I didn't seccess to recognize when).

Please help, thanks
Shlomit


Hi Shlomit

Try this:

Dim cell As Variant

For Each cell In myRng.Cells


--
Best regards
Leo Heuser

Followup to newsgroup only please.




Thulasiram[_2_]

For Each cell - Variable not defined (VBA)
 
Try declaring this before the code:

Dim cell as range
or
Dim myRng as range

On Jan 25, 2:54 am, Shlomit wrote:
Hi,

I wrote code that inclue :
For Each cell In myRng
...
next
I got error "Variable not defined" and I don't find the reason.
(I some cases it's work but I didn't seccess to recognize when).

Please help, thanks
Shlomit




All times are GMT +1. The time now is 08:02 AM.

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