SOLVED

VBA copy Value getting range from a specific cell

%3CLINGO-SUB%20id%3D%22lingo-sub-2768073%22%20slang%3D%22en-US%22%3EVBA%20copy%20Value%20getting%20range%20from%20a%20specific%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2768073%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20figure%20out%20how%20to%20copy%20value%20information%20from%201%20cell%20to%20another%20sheet.%3C%2FP%3E%3CP%3EI.E%20Get%20a%20range%20from%20a%20cell%20(cell%20B2)%20in%20sheet%20A.%20Then%20copy%20data%20from%20cell%20K5%20in%20sheet%20A%20to%20sheet%20B%20using%20the%20range%20specified%20in%20cell%20B2%20of%20sheet%20A.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20any%20help%20!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2768073%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2768215%22%20slang%3D%22en-US%22%3ERe%3A%20VBA%20copy%20Value%20getting%20range%20from%20a%20specific%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2768215%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1157733%22%20target%3D%22_blank%22%3E%40Jonathan865%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%E2%80%99re%20looking%20to%20ask%20a%20question%20or%20start%20a%20conversation%20about%20Excel%2C%20you%E2%80%99re%20in%20the%20right%20place!%3C%2FP%3E%3CP%3EAsk%20away.%3C%2FP%3E%3CP%3EPlease%20include%20the%20following%20info%20to%20help%20others%20answer%20your%20question.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexcel%2Fwelcome-to-your-excel-discussion-space%2Fm-p%2F2204395%22%20target%3D%22_self%22%3EWelcome%20to%20your%20Excel%20discussion%20space!%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20understanding%20and%20patience%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolinoDE%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2768579%22%20slang%3D%22en-US%22%3ERe%3A%20VBA%20copy%20Value%20getting%20range%20from%20a%20specific%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2768579%22%20slang%3D%22en-US%22%3EYour%20request%20lacks%20some%20detail%2C%20but%20I%20created%20something%20based%20on%20what%20I%20think%20you%20wanted.%20You%20could%20modify%20the%20code%20to%20what%20you%20had%20in%20mind.%3CBR%20%2F%3E%3CBR%20%2F%3E1.%20This%20code%20grabs%20the%20range%20that%20is%20entered%20into%20cell%20B2%20of%20sheet%20A%20into%20the%20variable%20%22GetRng%22.%3CBR%20%2F%3E2.%20Puts%20the%20value%20of%20cell%20K5%2C%20sheet%20A%2C%20into%20the%20range%20variable%20from%20step%201%20on%20sheet%20B.%3CBR%20%2F%3E%3CBR%20%2F%3ESub%20GetValue()%3CBR%20%2F%3EDim%20GetRng%20As%20Range%3CBR%20%2F%3E'set%20the%20variable%20to%20what%20has%20been%20entered%20into%20cell%20B2%20of%20sheet%20A.%3CBR%20%2F%3ESet%20GetRng%20%3D%20Sheets(%22A%22).Range(%22B2%22)%3CBR%20%2F%3E'Gets%20the%20value%20from%20cell%20K5%20in%20sheet%20A%20and%20puts%20it%20into%20whatever%20_%3CBR%20%2F%3E'cell(range)%20of%20sheet%20B%20that%20has%20been%20entered%20into%20cell%20B2%20of%20sheet%20A.%3CBR%20%2F%3E%3CBR%20%2F%3ESheets(%22B%22).Range(GetRng)%20%3D%20Sheets(%22A%22).Range(%22K5%22)%3CBR%20%2F%3EEnd%20Sub%3C%2FLINGO-BODY%3E
New Contributor

Hello,

 

I am trying to figure out how to copy value information from 1 cell to another sheet.

I.E Get a range from a cell (cell B2) in sheet A. Then copy data from cell K5 in sheet A to sheet B using the range specified in cell B2 of sheet A.

 

Thank you for any help !

2 Replies

@Jonathan865 

If you’re looking to ask a question or start a conversation about Excel, you’re in the right place!

Ask away.

Please include the following info to help others answer your question.

Welcome to your Excel discussion space!

 

Thank you for your understanding and patience

 

NikolinoDE

I know I don't know anything (Socrates)

best response confirmed by Jonathan865 (New Contributor)
Solution
Your request lacks some detail, but I created something based on what I think you wanted. You could modify the code to what you had in mind.

1. This code grabs the range that is entered into cell B2 of sheet A into the variable "GetRng".
2. Puts the value of cell K5, sheet A, into the range variable from step 1 on sheet B.

Sub GetValue()
Dim GetRng As Range
'set the variable to what has been entered into cell B2 of sheet A.
Set GetRng = Sheets("A").Range("B2")
'Gets the value from cell K5 in sheet A and puts it into whatever _
'cell(range) of sheet B that has been entered into cell B2 of sheet A.

Sheets("B").Range(GetRng) = Sheets("A").Range("K5")
End Sub