excel - Trying to write to a cell (Application defined or object defined error) -
i have following code:
for each cell in worksheets("bulk & prod").range("b4:m4") if strcomp(cell.value, "#n/a") windows("analysis.xlsx").activate dim y workbook set y = activeworkbook y.sheets("sheet1").range("a:" & num).setvalue (wb.name) num = num + 1 end if next cell
the idea want paste wb.name cell, num starts @ 1 , increments, leading nice column of file names. i've been using vba 3 days, , have hit dead end, awesome.
assuming num
set valid value, not 0, , wb
refers valid object, should remove colon range address , there no setvalue
method range in vba:
range("a" & num).value = wb.name
Comments
Post a Comment