Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Paste a value (SUM)

Hi!

In the clipboard I have a number (e.g. 123,40) which I want insert via
a VBA-Macro into a special cell. In an other cell there is a
SUM-Function which includes also the one where the value was
automatically pasted in.

Now there is the problem that after pasting the value it doesn't appear
in the sum unless I made a double click on the cell.

Does anybody have a hint?

Best Regards,
Nachtigall

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Paste a value (SUM)

In your code somewhere have you turned off automatic calculation? If so you
will need to turn it back on at the end of your sub. I tried doing this and
it worked fine. The calculation was: "B2=SUM(A1:A2)" Cell B2 was not
updated until after automatic calculation was turned on.

Application.Calculation = xlCalculationManual
Range("A1") = ClipboardGetText
Application.Calculation = xlCalculationAutomatic


Public Function ClipboardGetText() As String

' (works the same as VB6 Clipboard.GetText function)

Dim objDataObject As New DataObject

objDataObject.GetFromClipboard
ClipboardGetText = objDataObject.GetText(1)

End Function


" wrote:

Hi!

In the clipboard I have a number (e.g. 123,40) which I want insert via
a VBA-Macro into a special cell. In an other cell there is a
SUM-Function which includes also the one where the value was
automatically pasted in.

Now there is the problem that after pasting the value it doesn't appear
in the sum unless I made a double click on the cell.

Does anybody have a hint?

Best Regards,
Nachtigall


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Paste a value (SUM)

Do you really use VBA (or VisualBasic)?

Because I do not use the "GetFromClipboard"-Expression but
"ActiveSheet.Paste". Maybe this could be the error?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Paste a value (SUM)

I guess I misunderstood how you were pasting. I tried both methods and
discovered they don't exactly work the same. For example, if I copy lines
from this post by highlighting and using Ctrl-C, the ActiveSheet.Paste will
paste more than just text. It pastes formats, fonts, multiple lines into
multiple cells, etc. My method simply pastes text only into one cell, with
multiple lines as one text string having embedded CRLF's.

But, if I copy and paste a single number into one cell using either method
the calculation shows up immediately. I'm not sure what to tell you. I'm
still kind of new to Excel and VBA programming.

Did you check to see if automatic calculation is turned off somewhere?

I need to hit the road. Sorry I couldn't be of more assistance. Have a
nice weekend.

" wrote:

Do you really use VBA (or VisualBasic)?

Because I do not use the "GetFromClipboard"-Expression but
"ActiveSheet.Paste". Maybe this could be the error?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste and Paste Special No Longer Working - Excel 2003 SheriJ Excel Discussion (Misc queries) 2 January 15th 09 09:23 PM
In Excel: add a Paste-Special Option to paste IN REVERSE ORDER. stan-the-man Excel Worksheet Functions 7 June 14th 06 08:10 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
Macro to Paste to specific line, and continue to Paste each time on next row not over tomkarakowski[_2_] Excel Programming 1 May 28th 04 06:50 PM


All times are GMT +1. The time now is 11:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"