Copy Status bar macro

B

Bongard

I originally wanted to write a macro that would copy the value in the
status bar (sum of your selection or whatever function you have chosen)
but since I only use the sum function I thought it would be easier to
just use the sum fucntion of selection and copy it to the clipboard. I
found this macro and avice from an earlier post.


Sub Macro1()

'' Keyboard Shortcut: Ctrl+Shift+S

Dim MyData As DataObject
Set MyData = New DataObject

MyData.SetText
WorksheetFunction.Sum (Selection.SpecialCells(xlCellTypeVisible))
MyData.PutInClipboard

End Sub

In order to run since MyData is earlybind, you must go to tools
reference in
the VBA editor and select Microsoft Forms 2.0 Object Library. Or you
can
change to late bind (i.e. use CreateObject)


That being said, when I try to run the macro it gives me the error
Compile Error --- User-Defined type not defined.

In tools references in VBA I can not find that forms 2.0 object library
so I don't know if that is the problem.


Any ideas???

Thanks in advance!
 
D

Dave Peterson

Look for "Microsoft Office xx.x Object Library".

Another way to add this as a reference is to add a userform to your project.

I don't think you'll find a way to use late binding for this kind of thing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top