Xia Mey
Xia Mey

Reputation: 1

copy and store to clipboard

I would to copy my text from excel and store to clipboard by using AHK.

This is my code:

Xl.Range("A1").Copy
Xl.Range("A2").Copy
Xl.Range("A3").Copy
Xl.Range("A4").Copy

How to store A1-A4 to clipboard? Then I can paste back the clipboard manually.

Upvotes: 0

Views: 203

Answers (1)

Brad
Brad

Reputation: 12255

Dim wsSource As Worksheet, wsDest As Worksheet
Dim rngSource As Range, rngDest As Range
Set wsSource = ActiveSheet 'or whatever
Set wsDest = wsSource ' or whatever
Set rngSource = wsSource.Range("A1:A4")
Set rngDest = wsDest.Range("C1")
rngSource.Copy rngDest

Unless you actually want it to be on the clipboard for the user to user paste wherever they may choose then you change th elast line to rngSource.Copy

Upvotes: 1

Related Questions