excel - How to match data between sheets using loops -


okay breakdown.

i have 2 sheets. 1 sheet (order_lvl) has original data order numbers going down rows , "line numbers" locations integers of line in corresponding cells. i'm trying populate other sheet (sheet1) same order numbers going down rows, location numbers (1-246) column headers (essentailly values within cells of order_lvl becoming column headers of sheet1). within corresponding cells want put "1" if order_lvl indicates order features line location , "0" if not.

this have populating data , keep getting error saying "object not support propety or method" @ line if statement"

sub populatedata() dim s1 excel.worksheet dim s2 excel.worksheet set s1 = sheets("order_lvl") set s2 = sheets("sheet1") dim orderrows range dim lastrow integer lastrow = s1.cells(rows.count, 1).end(xlup).row set orderrows = range("b2" & lastrow) dim irow variant each irow in orderrows dim j variant     each j in s1.range("q:dl")     locationrow = 1     dim variant         each in s2.range("b1:je1")             if s1(irow, j) = s2(locationrow, i)             s2(irow, i) = 1 'indicates order features line location             else: s2(irow, i) = 0             end if         next     next j next irow end sub 

i'm new vba , guidance appreciated.

try repaired code below. please excuse me didn't read business context, (in bit of rush), repaired syntax problems in script....

sub populatedata() dim s1 worksheet dim s2 worksheet dim locationrow integer set s1 = sheets("order_lvl") set s2 = sheets("sheet1") dim orderrows range dim lastrow integer lastrow = s1.cells(rows.count, 1).end(xlup).row set orderrows = range("b2" & lastrow) dim irow integer  irow = 1 orderrows.rows.count dim cellj range     each cellj in s1.range("q:dl")     locationrow = 1     dim celli range         each celli in s2.range("b1:je1")             if s1.cells(irow, cellj.column).value = s2.cells(locationrow, celli.column).value             s2.cells(irow, celli.column).value = 1 'indicates order features line location             else: s2.cells(irow, celli).value = 0             end if         next celli     next cellj next irow end sub 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -