Excel vba -- Object required error at Sub line -


so getting error @ beginning of code, error didn't use last time opened , edited vba code. ideas? here part of it. when try step through code, error: "object required" , sub line (first line) highlighted. ideas how can fix this?

sub managercashflow()    '---------------------------declare variables---------------------------    '------define object names------    'dim integer    'dim c integer    dim aum_cash_projections_folder_pathname string    dim aum_cash_projections_folder_yearmonth_pathname string    dim aum_cash_projections_filename_date string    dim aumcshf_wb workbook    dim mngrcshf_wb workbook    'dim cshf_lr integer    'dim pe_r integer    'dim lstmanager_r integer      '------set/call objects destination------    'worksheets    'manager cashflow    set mngrcshf_wb = thisworkbook    set mcf_current_ws = mngrcshf_wb.sheets("sheet1")     'aum cash projections    set aum_cash_projections_folder_pathname = "https://iportal.casey.org/risk management/cfp reporting/aum cash projection"    set aum_cash_projections_folder_yearmonth_pathname = right(mcf_current_ws.cells(2, 1).value, 7)    set aum_cash_projections_filenamedate = mcf_current_ws.cells(2, 1).value    set aumcshf_wb = workbooks.open(aum_cash_projections_folder_pathname + "/" + aum_cash_projections_folder_yearmonth_pathname + "/" + aum_cash_projections_filenamedate)     set cshf_ws = aumcshf_wb.sheets("cashflow + projections")         'master data of current managers    set currassets_ws = aumcshf_wb.sheets("master data")    '... bunch of other code works.... end sub  

not sure why didn't happen before. don't need use set assign value string.

aum_cash_projections_folder_pathname = "https://iportal.casey.org/risk management/cfp reporting/aum cash projection" aum_cash_projections_folder_yearmonth_pathname = right(mcf_current_ws.cells(2, 1).value, 7) aum_cash_projections_filenamedate = mcf_current_ws.cells(2, 1).value 

you need declare mcf_current_ws , other worksheets. won't tell unless have "option explicit" @ top of code, it's do.

dim mcf_current_ws excel.worksheet 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -