Re: Passing local variable value to a global variable in a sub
The last three statements all need .value added to them to work i.e. Worksheets(SN).Range("AE3").value
I'm not sure what you mean by your second point. What count are you "picking up"? Where from, and where do you want it put?
BTW, when recording macros, there are many steps that can be removed to make your code much more efficient. Excel records every action into recorded macros, and this includes selection and activation etc. By removing these interactions with the sheet itself, you can speed things up a lot. e.g.
Range("AD3").Select
ActiveCell.FormulaR1C1 = "PSQ"
Range("AE3").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(R3C2:R500C2,""<>""&"""")"
Range("AD4").Select
ActiveCell.FormulaR1C1 = "Concur"
Range("AE4").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(R3C28:R500C28,""Y"")"
Range("AD5").Select
ActiveCell.FormulaR1C1 = "Reject"
Range("AE5").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(R3C28:R500C28,""N"")"
Display More
Can be reduced to:
Range("AD3").FormulaR1C1 = "PSQ"
Range("AE3").FormulaR1C1 = "=COUNTIF(R3C2:R500C2,""<>""&"""")"
Range("AD4").FormulaR1C1 = "Concur"
Range("AE4").FormulaR1C1 = "=COUNTIF(R3C28:R500C28,""Y"")"
Range("AD5").FormulaR1C1 = "Reject"
Range("AE5").FormulaR1C1 = "=COUNTIF(R3C28:R500C28,""N"")"
Hope this is helpful.
Dan