MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Macro almost works, please help


Posted by Ken on January 11, 2002 2:03 PM

I need this function to return every 54th value, but it almost does, except for the first instance of the function.

Function Plus54(var As Variant)
Dim i As Integer
i = i + 54
Plus54 = i
End Function

Thanks
Ken


Posted by DK on January 11, 2002 2:26 PM

Hello Ken,

I'm not sure what you're after but this function will only ever return 54.

'i' will always be zero when the function is run.

i=i+54 will always equal 54

Plus54=i will also always equal 54.

Can you explain a little more of what you're trying to achieve?

Regards,
D

Posted by Ken on January 11, 2002 2:40 PM

Hi D trying to return every 54th item from a range, will drag down function when it works

Hi D,

I want to return every 54th item in a range, if there is data in cells A1:A1000 I will place this function in Cell B1 an drag it down, returning every 54th item until it reaches 1000.

Thanks
Ken

Posted by Barrie Davidson on January 11, 2002 2:48 PM

Re: Hi D trying to return every 54th item from a range, will drag down function when it works

Ken, have a look at

http://ca.geocities.com/b_davidso/Web_Page_Files/Excel/misc.html

and check out the second last question. Hope this helps you out.

Barrie

Barrie Davidson

Posted by Ken on January 11, 2002 3:30 PM

Thanks Barry works great!