ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy to windows clipboard (https://www.excelbanter.com/excel-programming/290541-copy-windows-clipboard.html)

BillShut

Copy to windows clipboard
 
I want a macro that searches for data by finding a cell value and
choosing the data one cell to the right and copying it so I can paste
it in another program. I needs to pause while I switch to the other
program(s).

Then it will continue and go to another spot where I will look for
more data. This is harder because I don't know which cells are used.
That is in the Excel form the comment area has several cells and
people use different ones.

Can I do this, and can I call another macro after that.

Thanks so much.

Bill

Tom Ogilvy

Copy to windows clipboard
 
Sub FindData()
Dim rng as Range, rng1 as Range, Data
Data = Range("A1")
if isempty(Range("A1") then Exit sub
set rng = cells.Find(What:=data, After:=Range("A1"))
if not rng is nothing then
if rng.Address = "$A$1" then
msgbox "Not found, exiting"
exit sub
End if
set rng1 = rng.offset(0,1)
End if
rng1.copy

Application.OnTime Now + TimeValue("00:15"), "FindData"

End sub

put the data to find in cell A1

Change 15 seconds to the time you need. New data to be found is in A1.
Assumes you will not be looking for the same item in multiple cells. You
will have to paste in the other application - otherwise play with sendkeys
and wait

--
Regards,
Tom Ogilvy



"BillShut" wrote in message
om...
I want a macro that searches for data by finding a cell value and
choosing the data one cell to the right and copying it so I can paste
it in another program. I needs to pause while I switch to the other
program(s).

Then it will continue and go to another spot where I will look for
more data. This is harder because I don't know which cells are used.
That is in the Excel form the comment area has several cells and
people use different ones.

Can I do this, and can I call another macro after that.

Thanks so much.

Bill





All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com