Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Referencing range in another worksheet

I am trying to reference all the values in in column A in a different
worksheet.
I get errors using this. Please advise on the correct syntax.

Set AllCells = Worksheets("Data").Range("a2", Cells(Rows.Count,
"a").End(xlUp))
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Referencing range in another worksheet

Try this:

Set AllCells = Worksheets("Data").Range("a2", Cells(Rows.Count,
"a").End(xlUp).Address)


"gtslabs" wrote:

I am trying to reference all the values in in column A in a different
worksheet.
I get errors using this. Please advise on the correct syntax.

Set AllCells = Worksheets("Data").Range("a2", Cells(Rows.Count,
"a").End(xlUp))

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Referencing range in another worksheet

On Dec 11, 9:19*pm, JLGWhiz wrote:
Try this:

Set AllCells = Worksheets("Data").Range("a2", Cells(Rows.Count,
"a").End(xlUp).Address)



"gtslabs" wrote:
I am trying to reference all the values in in column A in a different
worksheet.
I get errors using this. *Please advise on the correct syntax.


Set AllCells = Worksheets("Data").Range("a2", Cells(Rows.Count,
"a").End(xlUp))- Hide quoted text -


- Show quoted text -


it only got 2 of the 17 cells that currently have data.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Referencing range in another worksheet

If that throws an error then try this:

Set AllCells = Worksheets("Data").Range("a2:" & Cells(Rows.Count,
"a").End(xlUp).Address)


"gtslabs" wrote:

I am trying to reference all the values in in column A in a different
worksheet.
I get errors using this. Please advise on the correct syntax.

Set AllCells = Worksheets("Data").Range("a2", Cells(Rows.Count,
"a").End(xlUp))

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Referencing range in another worksheet

On Dec 11, 9:31*pm, JLGWhiz wrote:
If that throws an error then try this:

Set AllCells = Worksheets("Data").Range("a2:" & Cells(Rows.Count,
"a").End(xlUp).Address)



"gtslabs" wrote:
I am trying to reference all the values in in column A in a different
worksheet.
I get errors using this. *Please advise on the correct syntax.


Set AllCells = Worksheets("Data").Range("a2", Cells(Rows.Count,
"a").End(xlUp))- Hide quoted text -


- Show quoted text -


same 2 cells returned


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referencing range in another worksheet

dim AllCells as range
with worksheets("Data")
set allcells = .range("a2",.cells(.rows.count,"A").end(xlup))
end with

msgbox allcells.address



gtslabs wrote:

I am trying to reference all the values in in column A in a different
worksheet.
I get errors using this. Please advise on the correct syntax.

Set AllCells = Worksheets("Data").Range("a2", Cells(Rows.Count,
"a").End(xlUp))


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Referencing range in another worksheet

On Dec 11, 9:46*pm, Dave Peterson wrote:
dim AllCells as range
with worksheets("Data")
* set allcells = .range("a2",.cells(.rows.count,"A").end(xlup))
end with

msgbox allcells.address

gtslabs wrote:

I am trying to reference all the values in in column A in a different
worksheet.
I get errors using this. *Please advise on the correct syntax.


Set AllCells = Worksheets("Data").Range("a2", Cells(Rows.Count,
"a").End(xlUp))


--

Dave Peterson


Yes, that worked - Thank you all
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
Referencing a named range based upon Range name entry in cell Barb Reinhardt Excel Worksheet Functions 14 June 20th 07 07:19 PM
CountIF() in Worksheet B while referencing cells in Worksheet A jfj3rd Excel Worksheet Functions 3 April 14th 06 11:24 PM
CountIF() in Worksheet B while referencing cells in Worksheet A jfj3rd Excel Worksheet Functions 3 April 14th 06 07:36 PM
Range error when referencing non active worksheet SP[_5_] Excel Programming 7 October 29th 05 07:07 PM
range referencing lakey13[_3_] Excel Programming 1 November 5th 04 10:46 PM


All times are GMT +1. The time now is 01:42 PM.

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

About Us

"It's about Microsoft Excel"