Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
winnie
 
Posts: n/a
Default Can macros output to a cell selected prior to running it?

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).
  #2   Report Post  
Steve
 
Posts: n/a
Default

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" wrote in message
...
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).



  #3   Report Post  
Dan Knight
 
Posts: n/a
Default

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).

  #4   Report Post  
Myrna Larson
 
Posts: n/a
Default

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
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).


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide hyperlink cell & replace with macros Jose Excel Worksheet Functions 1 February 14th 05 08:23 AM
Using a Text / Data output as a cell reference Jimboski Excel Discussion (Misc queries) 1 February 11th 05 07:31 PM
averaging from one selected cell to another anthonysuccar Excel Discussion (Misc queries) 0 January 6th 05 04:21 AM
averaging from one selected cell to another anthony_succar Excel Discussion (Misc queries) 0 January 6th 05 04:19 AM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 12:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"