Here are the 2 complete subroutines. I get an error if I do:
Call NewStockUpdateSummary(info
or
Call NewStockUpdateSummary(info
Private Sub NewStockbtn_Click()
'*******************************************
'PURPOSE: this button will allow user to insert a new stock manually
'USES SUBS: this sub uses Sub NewStockSummary, NewStockUpdateCurrentValue
'USES FUNCTION: GetInput to return the 7 inputs below
'*******************************************
'get Company name, symbol,date purchased, total price, commision
' share price, number of shares
Dim myPrompt(7), infoArray(7), returnInput As String
myPrompt(0) = "Company name?"
myPrompt(1) = "Company symbol?"
myPrompt(2) = "Date purchased?"
myPrompt(3) = "Total price?"
myPrompt(4) = "Commision?"
myPrompt(5) = "Share Price?"
myPrompt(6) = "Number of Shares"
For count = 0 To 6 Step 1
'get information
returnInput = GetInput(ByVal myPrompt(count))
If returnInput = "" Then 'tests for cancel button pressed
MsgBox ("No information entered. Program terminated")
Exit Sub
Else
infoArray(count) = returnInput
End If
Next count
Call NewStockUpdateSummary(infoArray())
Call NewStockUpdateCurrentValue(infoArray)
End Sub
Private Sub NewStockUpdateSummary(ByRef infoArray() As String)
'*******************************************
'PURPOSE: this places information for new stock in SUMMARY sheet
'*******************************************
'insert new row at row 8 for new stock
Worksheets("SUMMARY").Rows("8:8").Select
Selection.Insert Shift:=xlDown
'insert formulas and number formats in new row
Rows("9:9").Select
Selection.Copy
Rows("8:8").Select
Selection.PasteSpecial Paste:=xlPasteFormulasAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
'put Company name, symbol,date purchased, total price, commision
' share price, number of shares info into variables
Dim company, symbol As String
Dim datePurchased As Date
Dim totalPrice, commision, sharePrice As Currency
Dim numShares, count As Integer
'put the information into the variables
company = infoArray(0)
symbol = infoArray(1)
datePurchased = infoArray(2)
totalPrice = infoArray(3)
commision = infoArray(4)
sharePrice = infoArray(5)
numShares = infoArray(6)
'put the information into the spreadsheet
With Worksheets("SUMMARY")
.Range("A8").Value = company
.Range("B8").Value = symbol
.Range("C8").Value = datePurchased
.Range("D8").Value = totalPrice
.Range("E8").Value = commision
.Range("F8").Value = sharePrice
.Range("G8").Value = numShares
End With
End Sub
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73:





by: Idle_MindPosted on 2009-08-29 at 14:42:11ID: 25215467
That little snippet isn't giving me any errors...can you show us more of what you're doing?