+ Reply to Thread
Results 1 to 7 of 7

Put text of cell into cell selection

  1. #1
    Registered User
    Join Date
    11-05-2011
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    7

    Put text of cell into cell selection

    So basically, in cell G1 is the text "D4". When I press a command button I want it to take the value in cell G1 - ("D4") - and then in cell D4 enter the value 10.
    The code I tried is:
    Range(Range("G1").value).value = "10"
    However this does not work. Can anyone help me please?

  2. #2
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Put text of cell into cell selection

    Maybe I do not understand, try this.

    Range("G1").Value= "10"

  3. #3
    Registered User
    Join Date
    11-05-2011
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Put text of cell into cell selection

    That is not what I quite want I was just trying to make the question simpler by using a shorter example. I want to select the cell which is written in G1 and in this want to paste a value.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Put text of cell into cell selection

    Your suggest code line of:

    Please Login or Register  to view this content.
    should work -- when you say it does not can you elaborate (error message or unintended result?) - where is the code located VBE wise ?

  5. #5
    Registered User
    Join Date
    11-05-2011
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Put text of cell into cell selection

    Aha! I have found the problem. My full line of code was:
    Please Login or Register  to view this content.
    but now have realized that it had to be:

    Please Login or Register  to view this content.
    I am sorry to have wasted your time but thank you very much anyway for your help.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Put text of cell into cell selection

    Remembering to qualify can be a pain !

    You might find it easier to use With statements ?

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-05-2011
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Put text of cell into cell selection

    Ok thanks a lot will look into it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1