T
Tim
I just can't make my code work. If have different text in B2:B632
that, based on what the text is, needs to write a formula in G2:G632.
There are about 30 different text's in B, and they are names of Named
Ranges. I was trying to write:
(Simplified)
If B2.value = 1stNamedRange Then G2.Formula =
"=Average(1stNamedRange)
If B3.value = 2ndNamedRange Then G3.Formula =
"=Average(2ndNamedRange)
If B4.value = 1stNamedRange Then G4.Formula =
"=Average(1stNamedRange) , etc.
I wanted an array (in vba) that loops through each cell in B2:B632,
then places the formula in G2:G632.
I tried "If c.Value = 1stNamedRange Then
Worksheets("Sheet1").Range("g2:g632").Formula =
"=Average(1stNamedRange)"
I keep getting the error "Else without If", but my last line is "End
if"
Note: I used names other than 1stNamedRange in my Named Ranges. I can
adjust the VBA, if someone could show me what I'm doing wrong. Also, I
didn't declare anything at the beginning of the VBA. I tried different
stuff, but guess I'm totally lost. Thanks.
that, based on what the text is, needs to write a formula in G2:G632.
There are about 30 different text's in B, and they are names of Named
Ranges. I was trying to write:
(Simplified)
If B2.value = 1stNamedRange Then G2.Formula =
"=Average(1stNamedRange)
If B3.value = 2ndNamedRange Then G3.Formula =
"=Average(2ndNamedRange)
If B4.value = 1stNamedRange Then G4.Formula =
"=Average(1stNamedRange) , etc.
I wanted an array (in vba) that loops through each cell in B2:B632,
then places the formula in G2:G632.
I tried "If c.Value = 1stNamedRange Then
Worksheets("Sheet1").Range("g2:g632").Formula =
"=Average(1stNamedRange)"
I keep getting the error "Else without If", but my last line is "End
if"
Note: I used names other than 1stNamedRange in my Named Ranges. I can
adjust the VBA, if someone could show me what I'm doing wrong. Also, I
didn't declare anything at the beginning of the VBA. I tried different
stuff, but guess I'm totally lost. Thanks.