I'm trying to reference a data range table on an inactive sheet on Excel with VBA.
I can reference the sheet by making it active:
Sheets("DTC").Select
ActiveSheet.ListObjects("DTC_Table").ListColumns("Delay").DataBodyRange.Select
ActiveCell.Formula = "=IF(--IsColour(0,K2),""Active"",(IF(--IsColour(2500134,K2),""Active"",IF(--IsColour(4210752,K2),""Active"",IF(V2=""No"","""",""Inactive"")))))"
but I don't know why referencing an inactive sheet does not seem to work:
Sheets("DTC").ListObjects("DTC_Table").ListColumns("Delay").DataBodyRange.Select
ActiveCell.Formula = "=IF(--IsColour(0,K2),""Active"",(IF(--IsColour(2500134,K2),""Active"",IF(--IsColour(4210752,K2),""Active"",IF(V2=""No"","""",""Inactive"")))))
Thanks very much.