For Loops not running inside If statement Excel VBA -
i'm writing code update inventory spreadsheet on first of every month. have little knowledge of vba understand basics of programming. please excuse poor code.
the problem after initial if statement check, when true runs line directly below (adding new line) , not execute loops after edit data.
sub auto_open() dim stock(21) if date - day(date) + 1 = date range("'monthly office inventory'!a2").entirerow.insert = 0 21 stock(i) = range("current office inventory'!a2").offset(0, i).value next x = 0 21 range("'monthly office inventory'!b14").offset(0, x).value = stock(x) next x end if end sub
probably easiest way changing condition to:
if day(date) = 1 then
now, i'm writting on mac, think you'll idea (and correct if detail wrong).
Comments
Post a Comment