LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Convert a Find/Loop to an Array macro

On Sunday, April 17, 2016 at 4:42:35 AM UTC-7, Claus Busch wrote:
Hi Howard,

Am Sun, 17 Apr 2016 13:19:21 +0200 schrieb Claus Busch:

Sub Find_List_cRows()


the formula in the posted code does'nt work also.
Try it this way:

Sub Find_List_cRows()

Dim aRows As Long, cRows As Long
Dim varData As Variant, varOut() As Variant
Dim wsh As Worksheet

Application.ScreenUpdating = False

For Each wsh In Worksheets
With wsh
cRows = .Cells(.Rows.Count, "C").End(xlUp).Row
aRows = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("B1").Formula = "=IF(COUNTIF(C1:$C" & cRows & ",A1)0,A1,""missing"")"
.Range("B2:B" & aRows).Formula = _
"=IF(AND(COUNTIF($C$1:$C$" & cRows & ",A2)0,COUNTIF($B$1:B1,A2)<COUNTIF($C$1:$C$" _
& cRows & ",A2)),A2,""missing"")"
.Range("B1:B" & aRows).Value = .Range("B1:B" & aRows).Value
End With
Next 'wsh
Application.ScreenUpdating = True

End Sub


Regards
Claus B.
--



Hi Claus,

BINGO! That works as far as I can determine. I gave it about five different data sets and could not fool it.

Many thanks.

Howard
 
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
Find/Replace Macro; Need Loop ryguy7272 Excel Programming 7 July 7th 09 04:55 PM
Convert repetitive IF statements to array loop? bntringa[_4_] Excel Programming 5 January 27th 06 09:45 PM
convert excel data to 2-D array using macro David Excel Programming 4 November 13th 05 02:01 PM
Macro Loop, Find, and Total Lou Excel Programming 2 April 28th 04 04:33 PM
variant array containing cel adresses convert to actual ranges-array Peter[_21_] Excel Programming 5 December 10th 03 09:50 PM


All times are GMT +1. The time now is 03:25 AM.

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

About Us

"It's about Microsoft Excel"