Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
do loop help
Hi there,
I am trying to find unique codes and then removes the blank efficiently but i am not sure how to use a loop properly. In fact - don't really know how to write code as I am trying to teach myself - a assistance will be appreciated. Down the bottom I want to stop the autofill when the cells in column have no formulas. Sub ExtractUniqueEngCodes() Application.ScreenUpdating = False ActiveCell.FormulaR1C1 "=IF(COUNTIF(R5C1:R5000C1,RC[-2])=0,RC[-2],"""")" Selection.AutoFill Destination:=Range("G5:G7000") Type:=xlFillDefault 'this range could be dynamic if i knew how ActiveWorkbook.Names.Add Name:="BlanksRange", RefersTo:= _ "=OFFSET(Sheet1!$g$5,0,0,COUNTA(Sheet1!$A:$A), 1)" Visible:=True ActiveWorkbook.Names.Add Name:="NoBlanksRange", RefersTo:= _ "=OFFSET(Sheet1!$h$5,0,0,COUNTA(Sheet1!$e:$e), 1)" Visible:=True Range("H5").Select Selection.FormulaArray = _ "=IF(ROW()-ROW(NoBlanksRange)+1ROWS(BlanksRange)-COUNTBLANK(BlanksRange),"""",INDIRECT(ADDRESS(SMAL L((IF(BlanksRange<"""",ROW(BlanksRange),ROW()+ROW S(BlanksRange))),ROW()-ROW(NoBlanksRange)+1),COLUMN(BlanksRange),4)))" ' Do loop Selection.AutoFill Destination:=Range("h5:h1000") Type:=xlFillDefault 'this range could be dynamic if i knew how ' until Application.ScreenUpdating = True end sub thanks in anticipatio -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find loop doesn't loop | Excel Discussion (Misc queries) | |||
Loop | Excel Discussion (Misc queries) | |||
vba loop | Excel Discussion (Misc queries) | |||
Worksheet_Change - loop within a loop | Excel Programming | |||
HELP!!!! Can't stop a loop (NOT an infinite loop) | Excel Programming |