T tc Sep 11, 2007 #1 Hi. i have managed to store the active sheet name in a variable. how do i use this variable in a formula?
Hi. i have managed to store the active sheet name in a variable. how do i use this variable in a formula?
G Guest Sep 11, 2007 #2 Here is what the formula look like in the spreadsheet =SUM(Sheet2!A1:A5) To generate this in VBA MySheetName = "Sheet2" Range("A1").formula = "=SUM(" & MySheetName & "!A1:A5)"
Here is what the formula look like in the spreadsheet =SUM(Sheet2!A1:A5) To generate this in VBA MySheetName = "Sheet2" Range("A1").formula = "=SUM(" & MySheetName & "!A1:A5)"