Thread: Range help
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Range help

I don't know if it will work, but try

sheets("Sheet2").select

just before the for statement
and just before the next statement

the Rows.count statement may be looking at thew active sheet and Not sheet2

"N.F" wrote:

Couldnt get it to work:
This part of my code that when I run it it does work for the given range:


For Each myRecord In Range("A80:A" & _
Range("A" & Rows.Count).End(xlUp).Row)

However when I change the range and specify it in a different sheet it does
not work. Below you can see what I tried but did not work:

For Each myRecord In Sheets("Sheet2").Range("A1:A" & _
Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row)










"bj" wrote:

try sheets("Sheet2").range...

"N.F" wrote:

Hello happy Thursday!!

Instead of having: A range in the same worksheet starting in column "A" as
shown below, how can I tell the program that I need the Range "A" from sheet
2.
I tried: Range(Sheet2:A .......) But did not work. Anyone???

For Each myRecord In Range("A80:A" & _
Range("A" & Rows.Count).End(xlUp).Row)
'For Each myRecord In Range("write_this")

Thanks alot in advance