By using expertatexcel.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

expertatexcel.com

 


Workbooks(thisworkbook.name).sheets("xxxx").Range("DER_cc") ' get the range name in another workbook

This is a more advanced concept where you're managing multiple workbooks aka Excel Files.

Prerequisites
  • WorkBook
  • Collections
  • Workbooks Collection
  • ThisWorkbook
  • Sheets Collection
  • Range Name aka Named Range
  • Using Multiple Workbooks

    This code is needed when you're processing more than 1 workbook.

    Whenever you run VBA code by opening a spreadsheet it refers to ThisWorkBook.

    To reference a specific workbook you could reference it by it's name.

    Note that there is an issue with New Window command.

    So with in the workbook you're referencing a sheet called "xxxx" and within that sheet you're referencing a range name.

    So if you open a new workbook and want to retrieve a value from another workbook, this is the command you'd execute.

    Note that in this example you could have also used

    ThisWorkBook.Sheets("xxxx").Range("DER_cc")

    Not that the range name means DER = DEployment Report and cc is the cc on an email.

  •