Referencing range in another worksheet

  • Thread starter Thread starter gtslabs
  • Start date Start date
G

gtslabs

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))
 
Try this:

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

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






- Show quoted text -

it only got 2 of the 17 cells that currently have data.
 
If that throws an error then try this:

Set AllCells = Worksheets("Data").Range("a2:" & Cells(Rows.Count,
"a").End(xlUp).Address)
 
If that throws an error then try this:

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






- Show quoted text -

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

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

msgbox allcells.address

Yes, that worked - Thank you all
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top