Macro to Copy Cells to Clipboard If

Neuner

New Member
Joined
Jul 18, 2018
Messages
18
Have a large list of contacts and I want a macro that copies their email addresses, Column J, to the clipboard if they've been selected, ="a" in Column C.

It is a large amount of data so I believe I need to clear the clipboard first?

Code:
Dim oData As New DataObject 'object to use the ClipboardoData.SetText Text:=Empty 'Clear
oData.PutInClipboard

The contact list is constantly edited with some being deleted and others added periodically. I've named the row above and below the data information for function reference which has been working well for my sorting macros.
Code:
Range(.Cells(.Range("BorderFirstRow").Row + 1, "J"), _
                .Cells(.Range("BorderLastRow").Row - 1, "J"))

What do I need to do to have the macro copy the email address, Column J, if Column C = "a"? Am guessing I could use an HLookup but not sure if that would be the cleanest way to go?

Thank you!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I have the following but I don't know how to have it copy only the cell in Column J to the Clipboard.


Code:
Sub CopySelected()
Dim oData As New DataObject 
oData.SetText Text:=Empty 'Clear
oData.PutInClipboard
With Worksheets("Master")
    For Each Cell In Range(.Cells(.Range("BorderFirstRow").Row + 1, "C"), _
                .Cells(.Range("BorderLastRow").Row - 1, "C"))
        If Cell.Value = "a" Then
                
                .PutInClipboard
        End If
    End With
End Sub


Thank you for your help!
 
Upvote 0

Forum statistics

Threads
1,223,992
Messages
6,175,832
Members
452,674
Latest member
psion2600

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top