excel vba - Appending ranges based on a two dimensional conditional loop and exporting to a PDF -


i've tried looking @ other questions, doesn't seem work me. have worksheet called materialflow in have many columns , rows need columns (ones hard code) , rows (ones have word "card") in 8th column copied tab exported pdf keep getting errors. here code. i've managed copy "card" containing rows don't know how simultaneously of columns , associated headers. additionally, column qualifies row excluded, makes difficult.

sub racks_list() dim sws worksheet dim rl worksheet set sws = sheets("materialflow") set rl = sheets("reports") dim slr long dim sr long dim l long dim counter range dim comb_range range dim bigrange range dim headers range dim cardcount long dim mycount long cardcount = 0 mycount = 1 each counter in worksheets("materialflow").range("h9", "h500")     if counter.value = "card"         cardcount = cardcount + 1         if mycount = 1 set comb_range = counter.entirerow         set comb_range = application.union(comb_range, counter.entirerow)         mycount = mycount + 1      end if next worksheets("reports").activate 'copying headers headers.copy destination:=worksheets("reports").range(cells(1, 1), cells(1, 25)) 'copying card data  if cardcount > 0     comb_range.copy destination:=worksheets("reports").range("a2", "as500") 'rl.range("a1", "as500") = comb_range  else     rl.range("a1", "a2").value = "did not work"  end if   rl.range(cells(1, 1), cells(slr, 21))  .exportasfixedformat type:=xltypepdf, filename:="c:\users\******\desktop\racks.pdf", quality:= _  xlqualitystandard, includedocproperties:=true, ignoreprintareas:=false, _  openafterpublish:=true  end   worksheets("materialflow").activate  end sub 

it seems need 10 points post pic looks this. want copy info in headers 1, 3 , 5 , rows "card" tab

header1 header2 header3 header4 header5

data data card data data

data data call data data

data data empty data data


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -