getting values without using "select"

  • Thread starter Thread starter ornit
  • Start date Start date
O

ornit

hello all
I have a question:
I'm trying to use values from different worksheets but I don't know ho
to do it without using the "select" command, I don't even know if it'
possible.

Here is an example:

Sheets("january").Select
Range("A12").Select
Selection.copy

Can I get the value without "selecting" it first?

thank
 
It is almost always unnecessary to Select a range before using
it. For example,

Dim Var As Variant
Var = Worksheets("January").Range("A12").Value
' or
Worksheets("January").Range("A12").Copy


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Sheets("January").Range("A12").Copy _
Destination:=Sheets("February").Range("M9")
 
ornit

Range(Range("A1"), Range("A1").End(xlDown)).Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.Paste

is equal to.....

Range(Range("A1"), Range("A1").End(xlDown)).Copy _
Destination:=Sheets("Sheet2").Range("A1")

Instead of......

Dim actSht As Worksheet
Set actSht = ActiveSheet
Worksheets("Sheet2").Activate
Range("A1:J10").Select
Selection.Copy
actSht.Activate
Range("K43").Select
ActiveSheet.Paste

use.......

Worksheets("Sheet2").Range("A1:J10").Copy _
Destination:=ActiveSheet.Range("K43")

or, if you just want to copy values:

Range("K43").Resize(10, 10).Value = _
Worksheets("Sheet2").Range("A1:J10").Value

which bypasses using the Clipboard (and is analogous to Paste
Special/Values)

Gord Dibben Excel MVP
 
you can try =sheet!A1 (the cell you will use as reference)
or vlookup.
 

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