#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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
automatic range - named range give me circular reference... George Thorogood Excel Discussion (Misc queries) 0 February 22nd 07 07:53 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
formula to sort a range so that it matches the exact rows of a column that is outside that range? steveo Excel Discussion (Misc queries) 1 June 18th 06 02:05 AM
How to count dates within a certain range in a column with mutiple date range entries Krisjhn Excel Worksheet Functions 2 September 1st 05 01:59 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"