Excel Macros Searching a Cell for Contents and adding them if they are not there (for filepath) -
i working on macro info files , want multiple ways of accessing files (because of less computer literate coworkers have, used existing file)
i attempting check cell value see if ends in /report01.xls
, , if not add text (obviously said in code cell c1).
i have code can add text (the second set of code), unsure appropriate if else
statement should used check see if cell contains /report01.xls
sub macro1() filepath = application.getopenfilename("excel files(*.xls), *.xls") if filepath <> false range("c1").value = filepath end if 'uses file path data **(wanting insert code here said above)** workbooks.open filename:=worksheets("sheet1").range("c1").value end sub 'code add text end of file path range("c1").select dim c range each c in selection if c.value <> "" c.value = c.value & "/report01.xls" next
Comments
Post a Comment