paliman
Active Member
- Joined
- Jul 7, 2002
- Messages
- 255
Hello everyone.
I have a file with several sheets, each one named after an alphanumeric account code (18D08H, 20J03, and so on) and another one named Sld2000 populated with my data.
I want to put some values in each sheet, and at a certain point I need to use the value assigned to a variable as the condition in a conditional sum.
Here’s my attempt:
Dim AccNum As String
AccNum = ActiveSheet.Name
(…)
With ActiveCell
.Offset(1, 1).FormulaR1C1 = "=SUMIF(Sld2000!R1C2:R100C2,AccNum,Sld2000!R1C8:R100C8)"
In the spreadsheet I want to replace “AccNum” with the value of the variable; final formula should look like this (in the 18D08H tab):
=SUMIF(Sld2000!$B$1:$B$100;18D08H;Sld2000!$H$1:$H$100)
but so far I get the string “AccNum” as the second argument of my function:
=SUMIF(Sld2000!$B$1:$B$100;AccNum;Sld2000!$H$1:$H$100)
Another option would be to use the ActiveSheet name as the second argument, since AccNum always takes this value.
Thank you very much
I have a file with several sheets, each one named after an alphanumeric account code (18D08H, 20J03, and so on) and another one named Sld2000 populated with my data.
I want to put some values in each sheet, and at a certain point I need to use the value assigned to a variable as the condition in a conditional sum.
Here’s my attempt:
Dim AccNum As String
AccNum = ActiveSheet.Name
(…)
With ActiveCell
.Offset(1, 1).FormulaR1C1 = "=SUMIF(Sld2000!R1C2:R100C2,AccNum,Sld2000!R1C8:R100C8)"
In the spreadsheet I want to replace “AccNum” with the value of the variable; final formula should look like this (in the 18D08H tab):
=SUMIF(Sld2000!$B$1:$B$100;18D08H;Sld2000!$H$1:$H$100)
but so far I get the string “AccNum” as the second argument of my function:
=SUMIF(Sld2000!$B$1:$B$100;AccNum;Sld2000!$H$1:$H$100)
Another option would be to use the ActiveSheet name as the second argument, since AccNum always takes this value.
Thank you very much