View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
al al is offline
external usenet poster
 
Posts: 363
Default Referencing Diff Sheet in Formula in VBA

Right now I have a code line in my macro which says:
Range(CellLocation).Value = "=SUBTOTAL(9,'Main'!R1C5:R200C5)"

I want to replace 'Main' with a variable name (SheetName) that represents a
sheet name. I get errors if I if replace 'Main' with SheetName or
'SheetName'. Is it possible to do what I want?