VBA command for copying active cell content only

bhupender

New Member
Joined
Sep 24, 2013
Messages
17
Hello folks,
I tried the whole internet but couldnt find vba code for.
selecting active cell , then
f2 command, then
selecting all the content of the cell, then
copy all the content.

I have to enter a lot of data from excel to external application which support only values and not normal data copied from excel.

Please help, it looks easy, but doesnt have much knowledge of vba.

thanks
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,278
Assuming you just want to copy the values of the active cell use this:
Code:
Sub Copy_Values()
ActiveCell.ClearFormats
ActiveCell.Copy
End Sub
 

bhupender

New Member
Joined
Sep 24, 2013
Messages
17
Thanks for the reply mate. But in my case it doesn't serve the purpose. This command will work fine excel but for pasting value in external application I need to copy it using F2 > select all cell content > and then copy (I don't know why it doesn't take simple copy and paste).
So, I will be needing some code which can replicate these keyboard keys commands.

thanks


Assuming you just want to copy the values of the active cell use this:
Code:
Sub Copy_Values()
ActiveCell.ClearFormats
ActiveCell.Copy
End Sub
 

bhupender

New Member
Joined
Sep 24, 2013
Messages
17
F2 gets the cells into edit mode and then you can copy the content of the cell.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,278
With Vba you do not need to press F2 every time you want to copy a cell value.
I've been using Vba for years.
 

bhupender

New Member
Joined
Sep 24, 2013
Messages
17
don't know, but I have noticed in many applications, I have worked with allows values to be paste only when the same is copied after entering into edit mode of the cell.
I am not an expert of excel so doesn't know why it happens.
But anyways, if I can do something with excel, I believe that can be done with VBA as well.
can't you suggest a code that can replicate what I do manually and we'll see what happens.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,278
I do not know what else to tell you.
This is a very simple script which copies the active cells value into the clipboard

If you want a Macro to duplicate your exact commands then I suggest you use the Excel Macro Recorder.

From the main menu choose view then choose Macros at step through the obvious steps.
 

Forum statistics

Threads
1,082,019
Messages
5,362,711
Members
400,686
Latest member
Aakash

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top