+ Reply to Thread
Results 1 to 4 of 4

Paste Special Add Value - Neat Code?

  1. #1
    Registered User
    Join Date
    11-22-2010
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    1

    Paste Special Add Value - Neat Code?

    Hi,

    I'm wondering if anyone knows the concise coding to add a value onto an existing variable value, in essence just like when you hit copy, paste special, then add values onto the target cell. I've tried recording it, and it works through paste special, but the code looks really ugly, and the worksheet seems to jump around a bit (the macro works with numerous ranges throughout the workbook). I'm looking for a better way.

    for instance I am after something like this, although i realise it looks a bit circular:

    [code]range("variable").value = range("variable").value + range("another_variable").value[code]

    This clearly doesnt work - Is it at all possible?

    Thanks for your help.
    Last edited by royUK; 11-22-2010 at 10:33 AM. Reason: add code tags

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Paste Special Add Value - Neat Code?

    You can use pasteSpecial in your code, record a macro & then tidy it up
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Paste Special Add Value - Neat Code?

    When you say variable do you mean a variable you have defined in vba or a cell value?

    Maybe like this:

    Please Login or Register  to view this content.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Paste Special Add Value - Neat Code?

    maybe
    Please Login or Register  to view this content.

+ 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