excel - Macro for data in variable location -


so let’s see how can explain this.

i’m new vba , macros, , think i’m trying complex me @ moment.

i have data want in .html file. if open excel, data appears in column a, i’m interested in data regarding banana’s spots. because there nothing appears once, need find “this want” in column, , want copy next 18 rows there , paste in a4 (because have formula in other cells use data cells i’m pasting it)

the problem i’m having have 2 types of bananas, , in different folders, it’s variable location.

so 2 types banana , banana+

banana data in: \folder\quality\banana\v9.9\completed there folder per lot of banana (i.e. lot 123) , inside folder there results folder, , inside folder report.html

the same goes banana+, data in: \folder\quality\banana+\v.2.1\completed same before, folder per lot data folder, results folder, , report.html inside.

hope make sense.

this got far

sheet called “fruit” lotnumber in cell b1 path in cell f1 (that comes after select banana type drop down) path have written in cell

\\folder\quality\banana\v9.9\completed \\folder\quality\banana+\v2.1\completed   sub pulldata_click() 'find name of file data in 'lotnumber in cell b1 of sheet “fruit”  dim lotnumber string lotnumber = thisworkbook.sheets("fruit").range("b1").value dim path string path = thisworkbook.sheets("fruit").range("f1").value dim filename string set filename = path & "\lot" & lotnumber & "\data\results.html"  chdir "\\folder\quality" workbook.open filename:=filename   'search specific string want  dim spotsrow long  on error resume next spotsrow = application.worksheetfunction.match("this want", range("a:a"), 0) on error goto 0  if spotsrow > 0  'select 18 rows sheet bqcpublication_script, copy , paste in a4  sheets("bqcpublication_script").range("a" & spotsrow & ":a" & spotsrow + 18).copy thisworkbook.sheets("fruit").range("a4").pastespecial (xlpastevalues) 


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -