![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 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.
|
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Little Italy
Posts: 93
|
Try:
ActiveCell.Value = your result |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 6
|
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 |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Little Italy
Posts: 93
|
What are these lines suppose to do?
tri2 = tri1(userinput1, userinput2, userinput4) squr1 = squar1(userinput2, userinput3, userinput4) |
|
|
|
|
|
#5 |
|
New Member
Join Date: Mar 2002
Posts: 6
|
|
|
|
|
|
|
#6 |
|
New Member
Join Date: Mar 2002
Posts: 6
|
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 |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Mar 2002
Location: Little Italy
Posts: 93
|
If the functions work, where's the problem?
|
|
|
|
|
|
#8 |
|
New Member
Join Date: Mar 2002
Posts: 6
|
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)
|
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Mar 2002
Location: Little Italy
Posts: 93
|
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...
|
|
|
|
|
|
#10 |
|
New Member
Join Date: Mar 2002
Posts: 6
|
thanks works great now
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|