![]() |
passing a cells content into a macro
Cano1963 wrote: Here is my program it simple except for the fact of needing too many arguments. basically what I does is look to see if certain equipment is there if it is there it checks to see if it is new or refurb, then it get the cost of equipment and then it check for the accessories then it adds the cost of the accessory to the equipment cost. next, it check for other accessories until the last one and output cost of equipment to my work sheet. There are 4 types of equipment with 2 cost for each. then there are three types of accessories with 2 different costs for each. So you can see that it is easy but the arguments are too many to pass. ] sorry ahead for the sloppy programinig and english. i have been looking over net for days and trying different way to do this that i find that might help. Function equipmentcost(eqname As String, eqtype1 As String, eqtype2 As String, eqtype3 As String, eqtype4 As String, eqtype5 As String, eqtype6 As String, eqtype7 As String, eqamount1 As Integer) If eqname = "" Then equipmentcost = 0 ' this is if there is an empty eqname has no equipment cost cause there is no equipment Else Select Case eqname Case Is = "8000 GPRS:" 'checking if new or refurbed If eqtype1 = "refurb" Then ' equipmentcost = Active.worksheet3(58, 3) attempt 'checking for other equipment 'checking for pp1000 equipment 'Ifr Active.Worksheet(6, 7) = "refurb" Then 'Cells(1,1).Select' Will select the cell at A1 If ActiveCell.Address(6, 7) = "refurb" Then ' equipmentcost = Active.worksheet3(3, 58) + Active.worksheet3(3, 66) ElseIf Active.worksheet1!(6, 7) = "new" Then equipmentcost = Active.worksheet3(58, 3) + Active.worksheet3(67, 3) Else equipmentcost = Active.worksheet3(58, 3) End If 'done checking for pp1000 'checking for magteck reader equipment If Active.worksheet1(12, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(72, 3) ElseIf Active.worksheet1(12, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(73, 3) Else equipmentcost = equipmentcost End If 'done checking for magteck reader 'checking for vivo equipment If Active.worksheet1(15, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(76, 3) ElseIf Active.worksheet1(15, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(77, 3) Else equipmentcost = equipmentcost End If 'done checking for vivo 'done checking for all equipment Else equipmentcost = Active.worksheet3(59, 3) 'checking for other equipment 'checking for pp1000 equipment If Active.worksheet1(6, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(66, 3) ElseIf Active.worksheet1(6, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(67, 3) Else equipmentcost = equipmentcost End If 'done checking for pp1000 'checking for magteck reader equipment If Active.worksheet1(12, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(72, 3) ElseIf Active.worksheet1(12, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(73, 3) Else equipmentcost = equipmentcost End If 'done checking for magteck reader 'checking for vivo equipment If Active.worksheet1(15, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(76, 3) ElseIf Active.worksheet1(15, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(77, 3) Else equipmentcost = equipmentcost End If 'done checking for vivo 'done checking for all equipment End If Case Is = "Omni 3750" If (eqtype2 = refurb) Then equipmentcost = Active.worksheet3(60, 3) Else equipmentcost = Active.worksheet3(61, 3) End If Case Is = "Omni 3740" If (eqtype2 = refurb) Then equipmentcost = Active.worksheet3(62, 3) Else equipmentcost = Active.worksheet3(63, 3) End If Case Is = "Omni 3730" If (eqtype2 = refurb) Then equipmentcost = Active.worksheet3(64, 3) Else equipmentcost = Active.worksheet3(65, 3) End If Case Else 'equipmentcost = "1000.00" equipmentcost = Range("A58").Select ' will jump to that particular cell End Select End If End Function "Cano1963" wrote: I have a problem. I need to pass the contents of a cell int to a macro. I dont want to use it in the arguments of the macro cause i would have to pass 20 argument. what i want to see if there is a way to use something like (example but this doesnt work If ActiveCell.Address(6, 7) = "refurb" Then equipmentcost = Active.worksheet3(3, 58) + Active.worksheet3!(3, 66)) notice i try and and use Activecell.address(r,c) or active.worksheet3!(r,c) i want to use these type statment to pass the argument. not Function equipmentcost(eqname As String, eqtype1 As String, eqtype2 As String, eqtype3 As String, eqtype4 As String, eqtype5 As String, eqtype6 As String, eqtype7 As String, eqamount1 As Integer) i dont want to put 20 or 30 that many items in there. please help cause i am stuck. if you guys have a differnet way to approach this please tell me. thanks I hope my english is ok so sorry if it is not. Is there any way you could send me a sample of workbook? I think I have an idea of what you are trying to do, but I am not sure how everything is laid out. |
passing a cells content into a macro
Cano1963 wrote: how do i send it to you? can i do attachments? "meatshield" wrote: Cano1963 wrote: Here is my program it simple except for the fact of needing too many arguments. basically what I does is look to see if certain equipment is there if it is there it checks to see if it is new or refurb, then it get the cost of equipment and then it check for the accessories then it adds the cost of the accessory to the equipment cost. next, it check for other accessories until the last one and output cost of equipment to my work sheet. There are 4 types of equipment with 2 cost for each. then there are three types of accessories with 2 different costs for each. So you can see that it is easy but the arguments are too many to pass. ] sorry ahead for the sloppy programinig and english. i have been looking over net for days and trying different way to do this that i find that might help. Function equipmentcost(eqname As String, eqtype1 As String, eqtype2 As String, eqtype3 As String, eqtype4 As String, eqtype5 As String, eqtype6 As String, eqtype7 As String, eqamount1 As Integer) If eqname = "" Then equipmentcost = 0 ' this is if there is an empty eqname has no equipment cost cause there is no equipment Else Select Case eqname Case Is = "8000 GPRS:" 'checking if new or refurbed If eqtype1 = "refurb" Then ' equipmentcost = Active.worksheet3(58, 3) attempt 'checking for other equipment 'checking for pp1000 equipment 'Ifr Active.Worksheet(6, 7) = "refurb" Then 'Cells(1,1).Select' Will select the cell at A1 If ActiveCell.Address(6, 7) = "refurb" Then ' equipmentcost = Active.worksheet3(3, 58) + Active.worksheet3(3, 66) ElseIf Active.worksheet1!(6, 7) = "new" Then equipmentcost = Active.worksheet3(58, 3) + Active.worksheet3(67, 3) Else equipmentcost = Active.worksheet3(58, 3) End If 'done checking for pp1000 'checking for magteck reader equipment If Active.worksheet1(12, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(72, 3) ElseIf Active.worksheet1(12, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(73, 3) Else equipmentcost = equipmentcost End If 'done checking for magteck reader 'checking for vivo equipment If Active.worksheet1(15, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(76, 3) ElseIf Active.worksheet1(15, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(77, 3) Else equipmentcost = equipmentcost End If 'done checking for vivo 'done checking for all equipment Else equipmentcost = Active.worksheet3(59, 3) 'checking for other equipment 'checking for pp1000 equipment If Active.worksheet1(6, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(66, 3) ElseIf Active.worksheet1(6, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(67, 3) Else equipmentcost = equipmentcost End If 'done checking for pp1000 'checking for magteck reader equipment If Active.worksheet1(12, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(72, 3) ElseIf Active.worksheet1(12, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(73, 3) Else equipmentcost = equipmentcost End If 'done checking for magteck reader 'checking for vivo equipment If Active.worksheet1(15, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(76, 3) ElseIf Active.worksheet1(15, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(77, 3) Else equipmentcost = equipmentcost End If 'done checking for vivo 'done checking for all equipment End If Case Is = "Omni 3750" If (eqtype2 = refurb) Then equipmentcost = Active.worksheet3(60, 3) Else equipmentcost = Active.worksheet3(61, 3) End If Case Is = "Omni 3740" If (eqtype2 = refurb) Then equipmentcost = Active.worksheet3(62, 3) Else equipmentcost = Active.worksheet3(63, 3) End If Case Is = "Omni 3730" If (eqtype2 = refurb) Then equipmentcost = Active.worksheet3(64, 3) Else equipmentcost = Active.worksheet3(65, 3) End If Case Else 'equipmentcost = "1000.00" equipmentcost = Range("A58").Select ' will jump to that particular cell End Select End If End Function "Cano1963" wrote: I have a problem. I need to pass the contents of a cell int to a macro. I dont want to use it in the arguments of the macro cause i would have to pass 20 argument. what i want to see if there is a way to use something like (example but this doesnt work If ActiveCell.Address(6, 7) = "refurb" Then equipmentcost = Active.worksheet3(3, 58) + Active.worksheet3!(3, 66)) notice i try and and use Activecell.address(r,c) or active.worksheet3!(r,c) i want to use these type statment to pass the argument. not Function equipmentcost(eqname As String, eqtype1 As String, eqtype2 As String, eqtype3 As String, eqtype4 As String, eqtype5 As String, eqtype6 As String, eqtype7 As String, eqamount1 As Integer) i dont want to put 20 or 30 that many items in there. please help cause i am stuck. if you guys have a differnet way to approach this please tell me. thanks I hope my english is ok so sorry if it is not. Is there any way you could send me a sample of workbook? I think I have an idea of what you are trying to do, but I am not sure how everything is laid out. You can email me a komeat[ignorethis]shield [at] yahoo.com You can also get my email address by clicking on my profile. |
passing a cells content into a macro
Cano1963 wrote: I sent you an email just now. "meatshield" wrote: Cano1963 wrote: how do i send it to you? can i do attachments? "meatshield" wrote: Cano1963 wrote: Here is my program it simple except for the fact of needing too many arguments. basically what I does is look to see if certain equipment is there if it is there it checks to see if it is new or refurb, then it get the cost of equipment and then it check for the accessories then it adds the cost of the accessory to the equipment cost. next, it check for other accessories until the last one and output cost of equipment to my work sheet. There are 4 types of equipment with 2 cost for each. then there are three types of accessories with 2 different costs for each. So you can see that it is easy but the arguments are too many to pass. ] sorry ahead for the sloppy programinig and english. i have been looking over net for days and trying different way to do this that i find that might help. Function equipmentcost(eqname As String, eqtype1 As String, eqtype2 As String, eqtype3 As String, eqtype4 As String, eqtype5 As String, eqtype6 As String, eqtype7 As String, eqamount1 As Integer) If eqname = "" Then equipmentcost = 0 ' this is if there is an empty eqname has no equipment cost cause there is no equipment Else Select Case eqname Case Is = "8000 GPRS:" 'checking if new or refurbed If eqtype1 = "refurb" Then ' equipmentcost = Active.worksheet3(58, 3) attempt 'checking for other equipment 'checking for pp1000 equipment 'Ifr Active.Worksheet(6, 7) = "refurb" Then 'Cells(1,1).Select' Will select the cell at A1 If ActiveCell.Address(6, 7) = "refurb" Then ' equipmentcost = Active.worksheet3(3, 58) + Active.worksheet3(3, 66) ElseIf Active.worksheet1!(6, 7) = "new" Then equipmentcost = Active.worksheet3(58, 3) + Active.worksheet3(67, 3) Else equipmentcost = Active.worksheet3(58, 3) End If 'done checking for pp1000 'checking for magteck reader equipment If Active.worksheet1(12, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(72, 3) ElseIf Active.worksheet1(12, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(73, 3) Else equipmentcost = equipmentcost End If 'done checking for magteck reader 'checking for vivo equipment If Active.worksheet1(15, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(76, 3) ElseIf Active.worksheet1(15, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(77, 3) Else equipmentcost = equipmentcost End If 'done checking for vivo 'done checking for all equipment Else equipmentcost = Active.worksheet3(59, 3) 'checking for other equipment 'checking for pp1000 equipment If Active.worksheet1(6, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(66, 3) ElseIf Active.worksheet1(6, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(67, 3) Else equipmentcost = equipmentcost End If 'done checking for pp1000 'checking for magteck reader equipment If Active.worksheet1(12, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(72, 3) ElseIf Active.worksheet1(12, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(73, 3) Else equipmentcost = equipmentcost End If 'done checking for magteck reader 'checking for vivo equipment If Active.worksheet1(15, 7) = "refurb" Then equipmentcost = equipmentcost + Active.worksheet3(76, 3) ElseIf Active.worksheet1(15, 7) = "new" Then equipmentcost = equipmentcost + Active.worksheet3(77, 3) Else equipmentcost = equipmentcost End If 'done checking for vivo 'done checking for all equipment End If Case Is = "Omni 3750" If (eqtype2 = refurb) Then equipmentcost = Active.worksheet3(60, 3) Else equipmentcost = Active.worksheet3(61, 3) End If Case Is = "Omni 3740" If (eqtype2 = refurb) Then equipmentcost = Active.worksheet3(62, 3) Else equipmentcost = Active.worksheet3(63, 3) End If Case Is = "Omni 3730" If (eqtype2 = refurb) Then equipmentcost = Active.worksheet3(64, 3) Else equipmentcost = Active.worksheet3(65, 3) End If Case Else 'equipmentcost = "1000.00" equipmentcost = Range("A58").Select ' will jump to that particular cell End Select End If End Function "Cano1963" wrote: I have a problem. I need to pass the contents of a cell int to a macro. I dont want to use it in the arguments of the macro cause i would have to pass 20 argument. what i want to see if there is a way to use something like (example but this doesnt work If ActiveCell.Address(6, 7) = "refurb" Then equipmentcost = Active.worksheet3(3, 58) + Active.worksheet3!(3, 66)) notice i try and and use Activecell.address(r,c) or active.worksheet3!(r,c) i want to use these type statment to pass the argument. not Function equipmentcost(eqname As String, eqtype1 As String, eqtype2 As String, eqtype3 As String, eqtype4 As String, eqtype5 As String, eqtype6 As String, eqtype7 As String, eqamount1 As Integer) i dont want to put 20 or 30 that many items in there. please help cause i am stuck. if you guys have a differnet way to approach this please tell me. thanks I hope my english is ok so sorry if it is not. Is there any way you could send me a sample of workbook? I think I have an idea of what you are trying to do, but I am not sure how everything is laid out. You can email me a komeat[ignorethis]shield [at] yahoo.com You can also get my email address by clicking on my profile. Hmm, I haven't gotten it yet.. Did you send it to ? |
All times are GMT +1. The time now is 11:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com