Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

reading value from sheet1 into sheet2 using VBA

  Asked By: Glenn    Date: Jan 03    Category: MS Office    Views: 5851
  

I have to use value of a cell in sheet1 to sheet2 using VBA. Please let
me know how it could be possible using VBA.

Share: 

 

6 Answers Found

 
Answer #1    Answered By: Anthony Smith     Answered On: Jan 03

Any cell  in any worksheet can be referred to by being explicit thus:

Thisworkbook.Sheets("Sheet2").Range("C3")=ThisWork
book.Sheets("Sheet1").range("V45")

(those last two lines should be on one line)
or

ThisWorkbook.Sheets("Sheet1").range("V45").copy
Thisworkbook.Sheets("Sheet2").Range("C3")

(those last two lines should also be on one line)

 
Answer #2    Answered By: Edna West     Answered On: Jan 03

But if I want to store this
value in a variable then how could I do this.
Please let em know.

 
Answer #3    Answered By: Guilherme Silva     Answered On: Jan 03

to pass the info into a
varialble and then paste the variable, you would use:

Dim strString as String

strString = ThisWorkbook.Sheets("Sheet1").range("V45")
Thisworkbook.Sheets("Sheet2").Range("C3") = strString

 
Answer #4    Answered By: James Evans     Answered On: Jan 03

You just need to put the variable name in front of the = sign instead of the
destination cell. ie

variablename = ThisWorkbook.Sheets("Sheet1").range("V45")

 
Answer #5    Answered By: Clarence Nichols     Answered On: Jan 03

I notice if you just add ".Value" after each statement it also work.

Thisworkbook.Sheets("Sheet2").Range("C3").Value =
ThisWorkbook.Sheets("Sheet1").Range("V45").Value

Would there be something drastic wrong with this?

 
Answer #6    Answered By: Geena Ma.     Answered On: Jan 03

No, that's fine. What's going on is that .Value is the default property
of the .Range object, so it is assumed to be the relevant property if
you omit it.

 
Didn't find what you were looking for? Find more on reading value from sheet1 into sheet2 using VBA Or get search suggestion and latest updates.




Tagged: