why I can't find the max with this?

earp_

Active Member
Joined
Apr 30, 2008
Messages
305
Hi I have this...and it doesn't work. why?
Worksheets("sheet2").Range("C" & myColCheck).Value = WorksheetFunction.Max(Worksheets("daily").Range(pIndex & "2:" & pIndex & numRow))
where myColCheck it's a number of the row where i'm going to put the values
daily it's the sheet with different columns and
and pIndex says which column and numRow says the total of the lines for that row.
I started from 2 (pIndex & "2"...) because i want to find the max from row 2 to the end.
what's wrong here?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
It's hard to tell what's wrong without knowing what error you get and the values of myColCheck, pIndex and numRow at the time.
 
Upvote 0

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
Hi

Please don't be offended by this, but you have been posting many threads to this Board concerning VBA coding and you have got into a very bad habit of never posting your full code and yet expecting the readers of your posts to decode what is going on in your whole routine to suggest fixes.

This is very difficult for anyone to do without the whole code. For instance, it is impossible to tell from your code what pIndex is defined as, what value it holds, and where it gets this value from.

Also you state "it doesn't work" and then completely fail to explain how and why it doesn't work - do you get a debug error or is it simply a case of the result you get is not the one you expect? Again, with no details it is impossible for anyone to tell.

So in future, if you want to post questions that will get answered quickly without to and froing to get the full picture, just follow the following guidelines:

1. Post your full code
2. Explain what happens with your current code (not "it doesn't work") remembering to quote any error values received and also on which lines errors occur
3. Explain what you would like to happen in your current code

This way you will receive replies which will resolve youur issue much faster than otherwise.
 
Upvote 0

earp_

Active Member
Joined
Apr 30, 2008
Messages
305
No worries.
Only one thing.
When you say about 'posting your full code' you mean with an .xls file?
 
Upvote 0

earp_

Active Member
Joined
Apr 30, 2008
Messages
305
Btw thanks to everybody.
It's just I don't want to ask anyone to debug something like 1200 lines.
Could be worse though.
I will try to explain better next time with the whole code.
thanks again
 
Upvote 0

Forum statistics

Threads
1,190,913
Messages
5,983,531
Members
439,848
Latest member
timmyo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top