?
Solved

Copy into the clipboard and paste from clipboard into cell of currently selected table.

Posted on 2011-02-14
14
Medium Priority
?
274 Views
Last Modified: 2012-05-11
Dear Experts:

I would like to incorporate two code snippets in a couple of macro codes. I wonder whether you could help me out with then.

Code snippet 1:
A number with the following make-up (##-###-##-##) is to be selected in cell (15,1) of the currently selected table and copied into the clipboard.

Code snippet 2:
The clipboard is to be emptied and pasted into the currently selected table ...
in cell (16,2) after the 28th character.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
0
Comment
Question by:AndreasHermle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
14 Comments
 
LVL 8

Expert Comment

by:ragnarok89
ID: 34888314
You could just turn on Macro recording, perform the actions you describe, and then turn off Macro recording. A module would auto created containing the code version of the actions you just performed. You could then tweak it to your liking.

Al
0
 

Author Comment

by:AndreasHermle
ID: 34889509
Dear ragnarok89:

Thank you very much for your swift answer. I am aware that I could record it, but - to be honest with you - I would like a professional solution. The macro recorder often records things that in a strict programmer sense is no good.

Regards, Andreas
0
 

Author Comment

by:AndreasHermle
ID: 34895244
Dear all:

only code snippet 2 is relevant. In the meantime I found a solution for code snippet 1.

Here again my requirements for the code snippet:

The clipboard is to be emptied and pasted into the currently selected table ...
in cell (16,2) after the 28th character.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 30

Expert Comment

by:SiddharthRout
ID: 34922107
Can you give me an example?

Sid
0
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 1400 total points
ID: 34922132
If I understood your query then this is what you need?

Sub Sample()
    Sheets("Sheet1").Cells(16, 2).Value = Mid(Sheets("Sheet1").Cells(16, 2).Value, 1, 28) & _
                                          Format(Sheets("Sheet1").Cells(15, 1), "##-###-##-##") & _
                                          Mid(Sheets("Sheet1").Cells(16, 2).Value, 17)
End Sub

Open in new window


Sid
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 34922136
Please replace "Sheet1" with the respective Sheet Name.

Sid
0
 
LVL 43

Assisted Solution

by:Saqib Husain, Syed
Saqib Husain, Syed earned 600 total points
ID: 34922696
Commands for accessing the clipboard can be found here

http://www.cpearson.com/excel/Clipboard.aspx

Saqib
0
 

Author Comment

by:AndreasHermle
ID: 34932304
Hi Sid,  

thank you very much for your quick support.  I guess there must be some understanding here. My question refers to a Word problem. You are referring to Excel in your post.
But thank you anyway for the  time taken.

Regards,  Andreas
0
 

Author Comment

by:AndreasHermle
ID: 34932313
Hi Sagib:

thank  you very much for your swift help. This link is a valuable resource, thank you. But, as a matter of  fact, my question is a word problem not an Excel problem.

Thank you.

Regards, Andreas
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 34932492
You can make it work in Word by adding a reference to microsoft forms.

To do that, in VBA, go to

tools > references > browse

and select

c:\windows\system32\FM20.DLL

and make sure that microsoft forms 2.0 is in the list and checked.

Saqib
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 34932549
Andreas: My apologies for not checking that but then again the logic remains the same in word table as well.

Directly assign the value from one cell of the table to the another. You don't need a clipboard for it.

Sid
0
 

Author Closing Comment

by:AndreasHermle
ID: 34939097
Hi,

thank you very much to both of you for your professional. Regards, Andreas
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question