SOLVED! Function as Macro

ROBINSYN

Board Regular
Joined
Aug 19, 2002
Messages
188
Can I create a macro for a function.

=MAX(Z:Z)+1

The macro needs to select workbook"New Purchase Order" Sheetname"Purchase Order"

Then perform the function.

Can this be done?
This message was edited by ROBINSYN on 2002-10-27 16:44
This message was edited by ROBINSYN on 2002-10-27 22:05
This message was edited by ROBINSYN on 2002-10-28 07:21
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
This is how to code the function in a macro:

ActiveCell.FormulaR1C1 = "=MAX(C[25])+1"

But, I do not know what you really want, I did not understand your note?

Do you want the macro in one WorkBook, that opens another WorkBook and go's to a Sheet in that newly opened WorkBook and does what with your function? JSW
 
Upvote 0
Macro is in 1 Workbook. I have another macro that copies sheet 1 and creates a new workbook from the copied sheet. once that happens I want to save and close new workbook created,then return to 1st workbook then perform function.
This message was edited by ROBINSYN on 2002-10-27 01:02
 
Upvote 0
Would it work like this? Or do I need to use worksheetname too?

Sub ponumber()

If max Then
Cells("K8") = (max("Z:Z") + 1)
End If
End Sub
 
Upvote 0
if adding functions to macro is not possible. Is there a way I could have the macro run the function in a certain cell after sheet activation?
 
Upvote 0
Have a look in the VBA Editor
Lookup Application.Worksheetfunction

This is how you would need to code it in VBA
 
Upvote 0
Trying but can't seem to get the handle on this.

Result is suppose to go in cell K8

Set myrange = Worksheets("Purchase Order").Range("k8")
Set WorksheetFunction = xlMax
Application.WorksheetFunction.Max (("Z:Z") + 1)
 
Upvote 0
Please help! I don't understand how this increases the value of cell"K8" based on Column "Z" . Both column and cell are located on Worksheet"Purchase Order"

ActiveCell.FormulaR1C1 = "=MAX(C[25])+1"
This message was edited by ROBINSYN on 2002-10-27 22:08
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,428
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top