HEY EUgene, not giving correct result let me explain it to you why, 

Try these three example 
firrst in filter unselect first four option you will see correct result. 

Another one unselect lasst four option 
yes it works,

Another one unselect all select middle some values 
yes it work,s 

now the main question  try this one it gives you again 50 just because 
selection is not in any order. your code can only gives you correct value 
where the criteria is in order. as i said in starting two examples .


ActiveSheet.UsedRange.AutoFilter field:=1, Criteria1:= _
        Array("CP001", "CP007", "CS001", "CS002", "CS003", "DW001", 
"GC001", "GC002", "GC003", _
        "GC004", "GC005", "GC006", "HD001", "HD002", "HD003", "HD004", 
"HD005", "HD006", "KB001" _
        , "KB002", "LM001", "LM002", "LM003", "LM004", "MB001", "MB002", 
"MB003", "MB004", _
        "MB005", "MB006", "MB007", "RM001", "RM002", "RM003", "RM004", 
"RM005", "RM006", "RM007" _
        ), Operator:=xlFilterValues













On Saturday, 21 March 2015 18:48:58 UTC+5:30, Eugene Bernard wrote:
>
> Hi Mandeep,
>
> Just check the attached example.
>
> Regards
> Eugene
>
> On Fri, Mar 20, 2015 at 11:59 PM, Mandeep Baluja <rocke...@gmail.com 
> <javascript:>> wrote:
>
>> Hey Eugene,,not easy as you're thinking
>>  
>> This code will not give the correct result end -start +1 will never be 
>> equal to no of hide rows with filter, because these variable dont know the 
>> actual no of hidden rows between the data. 
>>
>> for example see data  if i hide 2 and 4, first visible row will be 2 and 
>> last visible row will be 6 , total values visible are 3 left(1,3,6)
>>
>> 6-2+1 = 5 
>>  
>> Data-A1
>> 1-A2
>> 2-A3
>> 3-A4
>> 4-A5
>> 5-A6
>>
>> Created this one working effectively on huge amount of data without 
>> taking time. :)
>>
>> ActiveSheet.UsedRange.Columns(1).Copy
>> Sheets(2).Range("a1").PasteSpecial
>> lr = Sheets(2).Cells(Rows.Count, 1).End(xlUp).Row
>> Debug.Print Sheets(2).UsedRange.Rows.Count - 1
>>
>> Regards, 
>> MandeepBaluja
>> Learningzmypassion.
>> https://www.facebook.com/VBAEXCELSQL?ref=hl
>> https://www.linkedin.com/profile/view?id=312532939
>>
>>
>>
>>
>>
>> On Friday, March 20, 2015 at 9:35:43 PM UTC+5:30, Eugene Bernard wrote:
>>>
>>> The below code already given in this group by Mr Asish Kumar....
>>>
>>> start= ActiveSheet.UsedRange.Offset(1).SpecialCells(
>>> xlCellTypeVisible).Row
>>> end= ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row
>>> norows=end-start+1
>>>
>>> Regards
>>> Eugene
>>>
>>> On Thu, Mar 19, 2015 at 12:56 PM, Mandeep baluja <mandee...@gmail.com> 
>>> wrote:
>>>
>>>>
>>>> any other code ?? excep this one 
>>>>
>>>> For Each rngarea In .SpecialCells(xlCellTypeVisible).Areas
>>>>                 lcount = lcount + rngarea.Rows.Count
>>>>             Next
>>>>
>>>>  -- 
>>>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? 
>>>> It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
>>>> https://www.facebook.com/discussexcel
>>>>  
>>>> FORUM RULES
>>>>  
>>>> 1) Use concise, accurate thread titles. Poor thread titles, like Please 
>>>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
>>>> will not get quick attention or may not be answered.
>>>> 2) Don't post a question in the thread of another member.
>>>> 3) Don't post questions regarding breaking or bypassing any security 
>>>> measure.
>>>> 4) Acknowledge the responses you receive, good or bad.
>>>> 5) Jobs posting is not allowed.
>>>> 6) Sharing copyrighted material and their links is not allowed.
>>>>  
>>>> NOTE : Don't ever post confidential data in a workbook. Forum owners 
>>>> and members are not responsible for any loss.
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "MS EXCEL AND VBA MACROS" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to excel-macros...@googlegroups.com.
>>>> To post to this group, send email to excel-...@googlegroups.com.
>>>> Visit this group at http://groups.google.com/group/excel-macros.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>>  -- 
>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
>> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
>> https://www.facebook.com/discussexcel
>>  
>> FORUM RULES
>>  
>> 1) Use concise, accurate thread titles. Poor thread titles, like Please 
>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
>> will not get quick attention or may not be answered.
>> 2) Don't post a question in the thread of another member.
>> 3) Don't post questions regarding breaking or bypassing any security 
>> measure.
>> 4) Acknowledge the responses you receive, good or bad.
>> 5) Jobs posting is not allowed.
>> 6) Sharing copyrighted material and their links is not allowed.
>>  
>> NOTE : Don't ever post confidential data in a workbook. Forum owners and 
>> members are not responsible for any loss.
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "MS EXCEL AND VBA MACROS" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to excel-macros...@googlegroups.com <javascript:>.
>> To post to this group, send email to excel-...@googlegroups.com 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/excel-macros.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to