View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Sum selected Range and copy to clip board

If this is within Excel, you do not need that method. But if you have a
range selected, what do you mean by the Activecell ?
May be you mean this:
Range("D1").Value = Application.Sum(Selection)

NickHK

"Dewey" wrote in message
ups.com...
Cheers,

any idea on the syntax to then paste from the clipboard.

Now I just need another macro that i'll bind to a key stroke so that it
does a 'paste values' command into the active cell.

Cheers

Dewey



NickHK wrote:

DataObject is part of the MSForms library, so you need to add a

reference.

NickHK

"Dewey" wrote in message
oups.com...
Hey Nick,

'DataObject' isn't a valid Dim so it errors out.

Any otherway??

Dewey


NickHK wrote:

Dewey,
Here's one way:

Private Sub CommandButton3_Click()
Dim MyData As DataObject
Set MyData = New DataObject
MyData.SetText Application.Sum(Selection)
MyData.PutInClipboard
End Sub

NickHK

"Dewey" wrote in message
oups.com...
Hi,

I'm sure its simple but I can't seem to work it out. I need a

macro
that sums the selected cells and copies it to the clipboard.

Any help would be greatly appreciated.

Cheers

Dewey