I need to know if it is possible to run a macro from a cel that you specify
right before runing the macro (i.e. a variable cell rather than the same
constant cell which is usually specified within the macro).
I need to know if it is possible to run a macro from a cel that you specify
right before runing the macro (i.e. a variable cell rather than the same
constant cell which is usually specified within the macro).
Hi Winnie
Store the required address in a spare worksheet.
Check your target address against your required address with If().
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Dim tAddr
Dim reqAddr
reqAddr = UCase(Worksheets("Sheet2").Range("A1").Value)
tAddr = Target.Address
If tAddr = reqAddr Then MsgBox "it works"
End Sub
HTH
Steve
"winnie" <[email protected]> wrote in message
news:[email protected]...
>I need to know if it is possible to run a macro from a cel that you specify
> right before runing the macro (i.e. a variable cell rather than the same
> constant cell which is usually specified within the macro).
Winnie;
This may be overly simplified, but if by "a cell that you specify", you're
thinking the activecell. Then in the macro simply refer to the Activecell
property.
Sub ()
prev code....
msgbox Activecell.address
rest of code...
end sub
"winnie" wrote:
> I need to know if it is possible to run a macro from a cel that you specify
> right before runing the macro (i.e. a variable cell rather than the same
> constant cell which is usually specified within the macro).
If you mean the macro returns a value, change the code so it puts that value
in the active cell, i.e.
'calculate some value, x, here
ActiveCell.Value = X
On Thu, 17 Feb 2005 13:23:02 -0800, winnie <[email protected]>
wrote:
>I need to know if it is possible to run a macro from a cel that you specify
>right before runing the macro (i.e. a variable cell rather than the same
>constant cell which is usually specified within the macro).
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks