+ Reply to Thread
Results 1 to 8 of 8

Copy From a "Object" to a single cell

  1. #1
    Registered User
    Join Date
    02-26-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    12

    Question Copy From a "Object" to a single cell

    Hi All,
    I am new to macro and i have a code in which, declared an Object GradeDynaset. This stores the the result of SQL queries. I would like to know how can the content of this Object can be pasted inside a single cell. Currently, I am able to paste into only on multile cells (Each content occupies a sepearte cell)
    Please Login or Register  to view this content.

    It will be very helpful if some one comes for my help

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Copy From a "Object" to a single cell

    i would loop the return and build off that.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy From a "Object" to a single cell

    Try something like this.

    Please Login or Register  to view this content.
    You may have to clean up the text in MyText to remove unwanted characters before putting it in B2.

  4. #4
    Registered User
    Join Date
    02-26-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Copy From a "Object" to a single cell

    Thanks for your response . I tried the above code but it din't work.

    Error: Run time error 438
    Message: Object dosenot support property or method

    MyCode:

    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy From a "Object" to a single cell

    Using The Clipboard In VBA

    Maybe this...

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-26-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Copy From a "Object" to a single cell

    Thanks mate!! it workedd!! But I am not able to remove the junk characters which appaear. The character looks like a question mark inside a box...could you please help in this?

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy From a "Object" to a single cell

    Quote Originally Posted by fblaze View Post
    Thanks mate!! it workedd!! But I am not able to remove the junk characters which appaear. The character looks like a question mark inside a box...could you please help in this?
    Determine which ASCII character it is (may be more than one type of character). It could be any one of the 30 or so non-printable characters at the start of the ASCII Table.

    Then you could replace the character with nothing (this example replaces ASCII character 3)
    MyText = Replace(MyText, Chr(3), "")

  8. #8
    Registered User
    Join Date
    02-26-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Copy From a "Object" to a single cell

    Thanks it worked!!

+ 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