ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy any clicked cell address like A1 or B4 to the clipboard (https://www.excelbanter.com/excel-programming/359056-copy-any-clicked-cell-address-like-a1-b4-clipboard.html)

up2you[_3_]

copy any clicked cell address like A1 or B4 to the clipboard
 

Hi friends,
when i select any cell (by clicking),
_*the_address_of_this_cell_*_(like B5) is going to be copied to the
clipboard *(not the value of cell).*

I am going to use this address for the other applications who works
with excel.

Any suggestions what is the code?

Thanks for your time....


--
up2you
------------------------------------------------------------------------
up2you's Profile: http://www.excelforum.com/member.php...o&userid=33468
View this thread: http://www.excelforum.com/showthread...hreadid=533502


Nick Hodge

copy any clicked cell address like A1 or B4 to the clipboard
 
You don't need the clipboard, you can either assign the address to the cell
or object you want, or store it in a range name/hidden worksheet or public
variable if you can use it in scope. My code uses the
worksheet_SelectionChange() Event which can be copied to the worksheet code
class (Right click on a sheet tab and select view code...). It copies the
address of the selected cell(s) to A1 on a sheet called Hidden Sheet.
Hopefully this will give you some ideas

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Worksheets("Hidden Sheet").Range("A1").Value = Target.Address
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"up2you" wrote in
message ...

Hi friends,
when i select any cell (by clicking),
_*the_address_of_this_cell_*_(like B5) is going to be copied to the
clipboard *(not the value of cell).*

I am going to use this address for the other applications who works
with excel.

Any suggestions what is the code?

Thanks for your time....


--
up2you
------------------------------------------------------------------------
up2you's Profile:
http://www.excelforum.com/member.php...o&userid=33468
View this thread: http://www.excelforum.com/showthread...hreadid=533502




up2you[_4_]

copy any clicked cell address like A1 or B4 to the clipboard
 

Hi Nick,
Thanks for your help but,
i can not use this for my application. for example,
there is a value in cell B4,
what i want is when i click this cell,
copy this cell's address B4 to the clipboard,
then i will open other application (unigraphics CAD program)
to assign or paste this B4 address to the place in UG window.

So i need to copy B4 address to the clipboard to use later for other
application for pasting..

Do you have any idea for the code?


--
up2you
------------------------------------------------------------------------
up2you's Profile: http://www.excelforum.com/member.php...o&userid=33468
View this thread: http://www.excelforum.com/showthread...hreadid=533502


Nick Hodge

copy any clicked cell address like A1 or B4 to the clipboard
 
You can copy the value to the clipboard by taking the same course and then
copying the cell, so

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Worksheets("Hidden Sheet").Range("A1").Value = Target.Address
Worksheets("Hidden Sheet").Range("A1").Copy
'It's now on the clipboard
End Sub

You may do better to put this over to a standard sub so you can run it from
a button or similar, the SelectionChange() event may now be overkill

Sub CopyAddressToClipBoard()
Worksheets("Hidden Sheet").Range("A1").Value = Selection.Address
Worksheets("Hidden Sheet").Range("A1").Copy
'It's now on the clipboard
End Sub

What you do after this is beyond me as I don't know the application you are
looking to paste it into.

If you can't automate the application at all then you may be able to
automate the last step, but that's over to you

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"up2you" wrote in
message ...

Hi Nick,
Thanks for your help but,
i can not use this for my application. for example,
there is a value in cell B4,
what i want is when i click this cell,
copy this cell's address B4 to the clipboard,
then i will open other application (unigraphics CAD program)
to assign or paste this B4 address to the place in UG window.

So i need to copy B4 address to the clipboard to use later for other
application for pasting..

Do you have any idea for the code?


--
up2you
------------------------------------------------------------------------
up2you's Profile:
http://www.excelforum.com/member.php...o&userid=33468
View this thread: http://www.excelforum.com/showthread...hreadid=533502





All times are GMT +1. The time now is 05:39 PM.

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