placeing marco results into a cell

seaaggie

New Member
Joined
Mar 19, 2002
Messages
6
I want to have the results from a macro go into a cell without haveing to use cells(1,2)=resultes. instead the results goes into the cell that is active.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
tried that I think it is something wrong with the macro this is the macro
Sub excavation()
Application.ScreenUpdating = False
config = MsgBox("enter quantities in feet only", , "excavation")
userinput1 = InputBox("grade change between manholes", "excavation", 1)
userinput2 = InputBox("distance between manholes", "excavation", 1)
userinput3 = InputBox("depth of excavation at highest FL elevation", "excavation", 1)
userinput4 = InputBox("width at bottom of trench", "excavation", 1)
tri2 = tri1(userinput1, userinput2, userinput4)
squr1 = squar1(userinput2, userinput3, userinput4)
total1 = squr1 + tri2
Cells(9, 5) = total1
End Sub
 
Upvote 0
What are these lines suppose to do?

tri2 = tri1(userinput1, userinput2, userinput4)
squr1 = squar1(userinput2, userinput3, userinput4)
 
Upvote 0
they go to two different functions
Function tri1(b, h, l)
tri1 = ((0.5 * (b * h)) * l) / 27
End Function
Function squar1(s, r, l1)
squar1 = (s * r * l1) / 27
End Function
 
Upvote 0
well I just tried the functions they work but the macro will not display the results in the worksheet active cell or for the macro I sent you cell (9,5)
 
Upvote 0
Works for me! I threw your functions on the top the code you sent earlier and it works just fine. I replaced the Cell definition by ActiveCell.Value = total1 and it writes the total1 in whatever Cell is active. No probs...
 
Upvote 0

Forum statistics

Threads
1,214,379
Messages
6,119,190
Members
448,874
Latest member
Lancelots

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