excel - Copy data data from one worksheet to another with a condition -


i'm working on macro helps me copy data 1 worksheet in excel conditions. tried following code; works, got infinite loop , not able make condition correctly in code (i have copy lines drop down list displays (complete), it's filled 3 options (complete/cancel/in process)

sub copier() dim ws1 worksheet, ws2 worksheet, src range, dest range, integer set ws1 = worksheets("workload - charge de travail") set ws2 = worksheets("sheet1")  = 2 ws1.usedrange.rows.count     set src = ws1.range("a2" & & ":ag10" & i)     set dest = ws2.range("a2" & & ":ag10" & i)     if source.cells(1, 4).value = "complete"          src.copy destination:=dest          dest.value = dest.value          next     end if end sub 

here changes code might help.

sub copier()     dim ws1 worksheet, ws2 worksheet, src range, dest range, integer      set ws1 = worksheets("workload - charge de travail")     set ws2 = worksheets("sheet1")      = 2 ws1.range("a1").specialcells(xllastcell).row                ' more reliable method used (which relies ont eh workbook being saved)             ' there must no gaps in column a.          ' code not work.  think whay happens increases!         ' ws1.range("a2" & & ":ag10" & i)          set src  = ws1.range("a" & & ":ag" & i+10  )         set dest = ws2.range("a" & & ":ag" & i+10 )           if source.cells(1, 4).value = "complete"               ' source?                 ' trying do!  think mean i+1 not 1.                   ' think mean src not source.  i'm not psychic.             src.copy destination:=dest            dest.value = dest.value         end if     next end sub 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -