ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Range help (https://www.excelbanter.com/excel-discussion-misc-queries/148315-range-help.html)

N.F[_2_]

Range help
 
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


bj

Range help
 
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


N.F[_2_]

Range help
 
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


bj

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



All times are GMT +1. The time now is 04:06 PM.

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