Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default passing a cells content into a macro


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

..
Use ParamArray and loop through the array

Function equipmentcost(paramarray eqname() as string)
Dim i as integer
For i = lbound(eqname) to ubound(eqname)
'do something
Next i
End Function

If you use the paramarray, you won't have to worry about declaring all
of those arguments individually. Just remember that the paramarray has
to be the last argument in the function call (i.e. you must have
function blah( str as string, paramarray newstr() as string), not
function blah(paramarray newstr() as string,str as string)

You might be better off passing a range to the function, then looping
through it and checking for certain phrases instead of passing all of
those strings, but I am not sure what you are doing, so I can't be
sure. Let me know if this helps.
I hope that helps.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro help: moving specific cells based upon content Scheetsky Excel Worksheet Functions 7 September 4th 09 02:59 PM
Macro to highlight cells based on content JimDerDog Excel Worksheet Functions 1 February 1st 06 03:51 PM
passing arguments from an excel macro to a word macro KWE39 Excel Discussion (Misc queries) 1 July 7th 05 03:56 PM
macro - hiding rows given a cells content Greg Stevens Excel Programming 3 October 15th 04 09:25 PM
passing variables from an excel macro to a powerpoint macro jake Excel Programming 1 December 11th 03 02:36 AM


All times are GMT +1. The time now is 05:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"