#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default =If(Macro)

Is there a way to incorporate a macro into an If/Then statement?
For example, in Cell A1: =If(B1="Johnson",SortJ,"")
<<where "SortJ" is the name of the recorded macro

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27,285
Default =If(Macro)

if you make SortJ a function

Sub SortJ()

End Sub

to

Function SortJ()


SortJ = "SomeValue"
End Function


So as the last line or at least some line, you assign a value for SortJ to
return to the cell for display.

If you have any selecting in the recorded macro, you will need to eliminate
that.

You will not be able to change any cells in any way - only return a value to
SortJ which will be displayed by your function. Just like a built in
function.

--
Regards,
Tom Ogilvy


"AntnyMI" wrote in message
oups.com...
Is there a way to incorporate a macro into an If/Then statement?
For example, in Cell A1: =If(B1="Johnson",SortJ,"")
<<where "SortJ" is the name of the recorded 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



All times are GMT +1. The time now is 07:40 AM.

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

About Us

"It's about Microsoft Excel"