tablecolumn - Excel VBA - add column to right and fill with text -


i want edit existing code (below), copies , pastes tables between 2 workbooks, following:

  1. add new column right of "vdb" (at end) copy of table wbtarget
  2. populate entire column text "total"
  3. then paste workbook called "sht1"

    dim vdb variant dim sht1 worksheet dim wbtarget workbook   'if sheet name "total" then... if "total" = sheet.name      'copy given range target workbook     vdb = wbtarget.sheets(sheet.name).range("b3:i102")      'paste range under existing data in master workbook     sht1.range("a" & rows.count).end(xlup)(2).resize(ubound(vdb, 1), ubound(vdb, 2)) = vdb  end if 

my failed attempt:

    dim vdb variant     dim sht1 worksheet     dim wbtarget workbook       if "total" = sheet.name          vdb = wbtarget.sheets(sheet.name).range("b3:i102")          vdb         .listcolumns.add         x = .listcolumns.count         .range(2, x) = "total"         end          sht1.range("a" & rows.count).end(xlup)(2).resize(ubound(vdb, 1), ubound(vdb, 2)) = vdb      end if 

i "object required" error. suggestions? i'm new vba...

add code line below @ end of current code:

' adding "total" last column on right sht1.range("a1").offset(, ubound(vdb, 2)).resize(ubound(vdb, 1) + 1, 1).value2 = "total" 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -