Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 10th, 2005, 04:34 PM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Macro excel

Hi all,

How can I do to asign to a variable in a macro the value of the cell selected with the mouse in the excel sheet?
Thanks
 
Old August 10th, 2005, 06:57 PM
Authorized User
 
Join Date: Feb 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sub Macro()
variable = activecell.value
end sub

this should do it
 
Old August 11th, 2005, 12:35 PM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Yes but when I execute the macro, I want to be able to visualize the value of the cell pointed with the mouse in a form. (label.caption or textbox.tex ).
So while the macro is running, the form is showing the value of each cell selected with the mouse.

Thanks for help me.

Mathias
 
Old August 13th, 2005, 06:55 PM
Authorized User
 
Join Date: Feb 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Private Sub Object_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) 'where Object can be a form, a label, a textbox 'etc
Object.Caption = Activecell.Value (for form, label)
Object.Text = activecell.value (for textbox)
End sub

I think the rest will be simple to you. I hope this is of help

End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro in Excel mateenmohd Excel VBA 3 June 16th, 2008 07:34 PM
Send It macro in excel hilding Excel VBA 2 September 6th, 2006 05:21 AM
exporting 2 excel by macro anukagni Access 2 January 30th, 2006 02:38 AM
Excel 2000 vs Excel 2002 Macro Issue williadn Excel VBA 1 July 14th, 2005 09:09 AM
Excel 4.0 macro sezak99 Excel VBA 1 September 21st, 2003 11:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.