Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to copy to cashe?

Dear VBA gurus

I have data
11111, abc, xxx,
22222, def, yyy
33333, ghi, zzz

I need to create a VBA code to copy vlaue
11111|22222|33333 (yes, that exact format with |) to the cache so user can
Paste, please HELP!!!!

Thanks to all
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default How to copy to cashe?

Denis,

One method follows. Copy both the sub and the function below into a standard
code module. This assumes that each line of your data resides in one cell (or
column) - you didn't specify about this...
Anyway, select the cells containing your data first, then run the Sub
TestThis(). After it runs, the result is placed in the clipboard and you can
paste it from there.

Sub TestThis()

Dim rCell As Range
Dim sData As String
For Each rCell In Selection
If rCell.FormulaR1C1 < "" Then sData = sData & Left(rCell.FormulaR1C1,
5) & "|"
Next
sData = Left(sData, Len(sData) - 1)
Call ClipboardAddString(sData)
MsgBox sData
End Sub

Public Function ClipboardAddString(argString As String)
'REQUIRED: REFERENCE TO MICROSOFT FORMS 2.0 OBJECT LIBRARY
'PROGRAMMATICALLY PLACE DATA IN THE CLIPBOARD;
Dim objData As DataObject
Set objData = New DataObject
objData.SetText argString
objData.PutInClipboard
End Function

HTH.

"Denis Petrov" wrote:

Dear VBA gurus

I have data
11111, abc, xxx,
22222, def, yyy
33333, ghi, zzz

I need to create a VBA code to copy vlaue
11111|22222|33333 (yes, that exact format with |) to the cache so user can
Paste, please HELP!!!!

Thanks to all

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default How to copy to cashe?

Denis,

Also, I should have pointed out (although it is included in my comments in
the function) that you need to set a reference to "Microsoft Forms 2.0 Object
Library".
Do this by opening the visual basic editor, then goto <Tools then
<References then check the appropriate box.

HTH/

"Denis Petrov" wrote:

Dear VBA gurus

I have data
11111, abc, xxx,
22222, def, yyy
33333, ghi, zzz

I need to create a VBA code to copy vlaue
11111|22222|33333 (yes, that exact format with |) to the cache so user can
Paste, please HELP!!!!

Thanks to all

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to copy to cashe?

qurtz,

this is great!!!!

The only problem is that I can not find MICROSOFT FORMS 2.0 OBJECT LIBRARY
on my Excel 2003. I do have SP1 and installed O2003PIA. Please help!

thanks again for your help. I have pieces of code working, until it come to
DataObject... :(

"quartz" wrote:

Denis,

Also, I should have pointed out (although it is included in my comments in
the function) that you need to set a reference to "Microsoft Forms 2.0 Object
Library".
Do this by opening the visual basic editor, then goto <Tools then
<References then check the appropriate box.

HTH/

"Denis Petrov" wrote:

Dear VBA gurus

I have data
11111, abc, xxx,
22222, def, yyy
33333, ghi, zzz

I need to create a VBA code to copy vlaue
11111|22222|33333 (yes, that exact format with |) to the cache so user can
Paste, please HELP!!!!

Thanks to all

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
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM
How copy format, font, color and border without copy/paste? Michel[_3_] Excel Programming 1 November 5th 03 04:43 PM


All times are GMT +1. The time now is 05:13 AM.

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

About Us

"It's about Microsoft Excel"