cmefly
Well-known Member
- Joined
- May 13, 2003
- Messages
- 683
hi all,
i've developed a macro but it seems not to be working.
It basically looks at cell C5 and based on it's value runs a certain part of the macro. (i used IFs and ELSEIFs in my macro). The thing is, it doesn't work...can someone tell me where i'm going wrong....??? and if i want to put this in the worksheet module so that it constantly works, how do i go about modifying the macro....?
here it is....
Sub Macro1()
If c5 = "July 1 /03 - Sept 30 /03" Then
b13 = _
"=VLOOKUP(RC[-1]&""close"", 'Q3_03 DATA'!R1C1:R40C136, MATCH(R5C2, 'Q3_03 DATA'!R2C1:R2C136,0),FALSE)" ElseIf c5 = "Jan 1 /03 - March 31 /03" Then
b13 = _
"=VLOOKUP(RC[-1]&""close"", 'Q1_03 DATA'!R1C1:R40C136, MATCH(R5C2, 'Q1_03 DATA'!R2C1:R2C136,0),FALSE)"
ElseIf c5 = "April 1 /03 - June 30 /03" Then
b13 = _
"=VLOOKUP(RC[-1]&""close"", 'Q2_03 DATA'!R1C1:R40C136, MATCH(R5C2, 'Q2_03 DATA'!R2C1:R2C136,0),FALSE)"
ElseIf c5 = "Oct 1 /03 - Dec 31 /03" Then
b13 = _
"=VLOOKUP(RC[-1]&""close"", 'Q4_03 DATA'!R1C1:R40C136, MATCH(R5C2, 'Q4_03 DATA'!R2C1:R2C136,0),FALSE)"
ElseIf c5 = "Oct 1 /02 - Dec 31 /02" Then
b13 = _
"=VLOOKUP(RC[-1]&""close"", 'Q4_02 DATA'!R1C1:R40C136, MATCH(R5C2, 'Q4_02 DATA'!R2C1:R2C136,0),FALSE)"
End If
End Sub
thank you very much for you time....
any help would be greatly appreciated
cmefly
i've developed a macro but it seems not to be working.
It basically looks at cell C5 and based on it's value runs a certain part of the macro. (i used IFs and ELSEIFs in my macro). The thing is, it doesn't work...can someone tell me where i'm going wrong....??? and if i want to put this in the worksheet module so that it constantly works, how do i go about modifying the macro....?
here it is....
Sub Macro1()
If c5 = "July 1 /03 - Sept 30 /03" Then
b13 = _
"=VLOOKUP(RC[-1]&""close"", 'Q3_03 DATA'!R1C1:R40C136, MATCH(R5C2, 'Q3_03 DATA'!R2C1:R2C136,0),FALSE)" ElseIf c5 = "Jan 1 /03 - March 31 /03" Then
b13 = _
"=VLOOKUP(RC[-1]&""close"", 'Q1_03 DATA'!R1C1:R40C136, MATCH(R5C2, 'Q1_03 DATA'!R2C1:R2C136,0),FALSE)"
ElseIf c5 = "April 1 /03 - June 30 /03" Then
b13 = _
"=VLOOKUP(RC[-1]&""close"", 'Q2_03 DATA'!R1C1:R40C136, MATCH(R5C2, 'Q2_03 DATA'!R2C1:R2C136,0),FALSE)"
ElseIf c5 = "Oct 1 /03 - Dec 31 /03" Then
b13 = _
"=VLOOKUP(RC[-1]&""close"", 'Q4_03 DATA'!R1C1:R40C136, MATCH(R5C2, 'Q4_03 DATA'!R2C1:R2C136,0),FALSE)"
ElseIf c5 = "Oct 1 /02 - Dec 31 /02" Then
b13 = _
"=VLOOKUP(RC[-1]&""close"", 'Q4_02 DATA'!R1C1:R40C136, MATCH(R5C2, 'Q4_02 DATA'!R2C1:R2C136,0),FALSE)"
End If
End Sub
thank you very much for you time....
any help would be greatly appreciated
cmefly